The Problem is that when the user pr" /> The Problem is that when the user pr" /> The Problem is that when the user pr"/>

How to prevent mobile Safari from closing the keyboard when a button is pressed?

404 Views Asked by At

I have an input field of type text and a submit button:

<input type="text">

<button type="submit">Submit</button>

The Problem is that when the user presses the submit button on mobile Safari, the input is unfocused/blurred and the software keyboard disappears.

How do I make the input keep focus?

Just setting focus on the input when the button is pressed is no option because I only want to keep the keyboard open if it has been open before submit press. If the keyboard has been manually closed before pressing the button, I don't want it to open.

How can I achieve this behavior?

0

There are 0 best solutions below