when I set focus on a textarea with textarea.focus(); it won't open the virtual keyboard, unless I execute a physical touch on the page before.
A) I open the page on my SmartPhone. The page simply contains this code:
<textarea id="textarea" rows="5" cols="20">
test
</textarea>
Then I execute the following code:
textarea.focus();
-> The textarea has focus now, the cursor inside the textarea appears, but the virtual keyboard does not open.
B) I open the same page on my SmartPhone.
This time I touch the page on a random position (just not inside the textarea. The textarea at this point has no focus).
Then I also execute the same code:
textarea.focus();
-> The textarea has focus now, the cursor inside the textarea appears, BUT this time the virtual keyboard actually appears.
A synthetic touch, createt like this, also does not work:
// Create a synthetic click MouseEvent
let evt = new MouseEvent("click", {
bubbles: true,
cancelable: true,
view: window
});
Can anyone help me?
Kind regards Robin