Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dialog's initialFocus on input does not trigger iOS shifting view up #3063

Open
Propaganistas opened this issue Mar 27, 2024 · 1 comment
Open

Comments

@Propaganistas
Copy link

Propaganistas commented Mar 27, 2024

What package within Headless UI are you using?

@headlessui/vue

What version of that package are you using?

v1.7.19

What browser are you using?

Safari for iOS (on iPhone)

Reproduction URL

https://codesandbox.io/p/devbox/dreamy-bohr-k789qp

RPReplay_Final1711570115.MP4

Describe your issue

Whenever an input gets selected that is located somewhere in the bottom part of the screen, iOS is so kind to shift the current view up automatically to make room for showing the keyboard while still keeping the selected input on screen.

Using the Dialog examples in TailwindUI (items-end sm:items-start) the dialog is positioned at the bottom on mobile. But when the first focusable element (or element set explicitly by initialFocus) is an input element, the keyboard displays without the view shifting up, hence partially/completely hiding the dialog below the keyboard.

If you'd create a dialog with another element being focused first, and then click on the input inside the dialog, the view shifts up properly. Could it be that initialFocus is applied too early for iOS to pick it up properly? Just thinking out loud.

@ngtankhoa
Copy link

I am experiencing the same issue with using Next.js.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants