Mobile keyboard: prediction/suggestion bar missing on Pavlovia

Hi everyone!

I am running a typing experiment on Pavlovia on PsychoPy version 2025.1.1 on phones and computers. I need to allow participants to use autocorrect and predictive text on their phones (ios/android).

  • I’m using an Editable Textbox component
  • On mobile devices, the keyboard opens correctly and the focus is maintained between routines

Problem: The prediction/suggestion bar (that suggests words above the keyboard) never appears. It looks like a basic keyboard without any suggestion features.

What I’ve tried

I’ve tried to manually inject HTML into a Code component to force the browser to recognise it as a standard field, but with no luck so far.

let inputs = document.getElementsByTagName('input');

 for (let i = 0; i < inputs.length; i++) {

        let el = inputs[i];

        el.setAttribute('type', 'text');

        el.setAttribute('inputmode', 'text');

        el.setAttribute('autocorrect', 'on');

        el.setAttribute('autocomplete', 'on');

        el.setAttribute('spellcheck', 'true');

        el.focus();

}

Questions:

  • Does PsychoJS explicitly set inputmode or type to something that prevents the OS from showing the prediction bar?
  • Is there another way to initialize a textbox so that the mobile browser will treat it as a “normal” field? (like a chat or email field)

Any insights would be appreciated, thank you!

Nevermind, I figured it out! I created a function to activate/deactivate the autocorrect or prediction.

window.activateAutocorrect = function (status) {
  if (window.nativeInput) {
    if (status === true) {
      window.nativeInput.setAttribute("autocorrect", "on");
      window.nativeInput.setAttribute("autocomplete", "on");
      window.nativeInput.setAttribute("spellcheck", "true");
    } else {
      window.nativeInput.setAttribute("autocorrect", "off");
      window.nativeInput.setAttribute("autocomplete", "off");
      window.nativeInput.setAttribute("spellcheck", "false");
    }
  }
};

And then I can call the function with the status true/false according to my needs.

It wasn’t working earlier because I wasn’t calling it explicitly in my PsychoPy experiment.