I am currently developing the login aspect inside a custom browser on ios. I want to open the keyboard when a user clicks on an input element. When an input element gets clicked, I set the 'autofocus' attribute for that element, followed by a focus on the element. However, these steps are not sufficient for opening the keyboard. I have tried methods present in the link: IOS show keyboard on input focus, but nothing works. The software version I'm working with is 14.4.2.
I am testing the app on an iPad.
var ev = new MouseEvent('click', {
'view': window,
'bubbles': true,
'cancelable': true,
'screenX': x,
'screenY': y
});
//x and y are the screen coordinates of the point where a user clicks.
var el = document.elementFromPoint(x, y);
console.log("Clicked element: "+el); //print element to console
el.addEventListener('click', function() {
el.setAttribute('autofocus', 'autofocus');
el.focus();
});
el.dispatchEvent(ev);