[Enhancement] [drawer] Abilty to set focus on inputs in pop ups (IOS safari) #16374
markharwood
started this conversation in
Feature Request
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Feature type:
Enhancement
Details
drawer
Description
This is a general enhancement request for all forms of pop up (drawers, dialogs etc) when running on IOS Safari.
It is often useful to allow iphone users to click something and have a popup input be focused and ready for input (think of a "prompt" type interaction).
Unfortunately, Apple have decided to not fully honour the focus() method on inputs (or autofocus attribute). This is a deliberate design decision by them to prevent soft keyboards popping up and taking up screen space unless the user really wants it. How Apple determines "if a user really wants it" is the tricky part - only calls to input.focus() that are part of a synchronous code block handling a click event will actually focus on an input and bring up the keyboard. Sadly one or more of the steps involved in opening an element-plus popup today can be async e.g.:
This means Apple doesn't see the final focus() call as a direct result of the original user click and ignores the request.
Reproduction
Here is an example of element-plus popups unable to set focus on iPhone but a synchronous creation of an input does.
Additional comments
I have looked at a hack with dummy invisible inputs but that hasn't worked for me.
If there isn't a hack that works with the existing async sequence of events shown above then I guess the enhancement request is to consider offering an alternative synchronous means of opening popups just to keep Apple's quirky logic happy.
(If I've missed an obvious solution sorry for the noise, but I've been unable to find a solution for days).
0 votes ·
Beta Was this translation helpful? Give feedback.
All reactions