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

iOS Safari Combobox focused on page load #2653

Closed
johntboyer opened this issue Aug 7, 2023 · 1 comment · Fixed by #2654
Closed

iOS Safari Combobox focused on page load #2653

johntboyer opened this issue Aug 7, 2023 · 1 comment · Fixed by #2654
Assignees

Comments

@johntboyer
Copy link

What package within Headless UI are you using?

@headlessui/react

What version of that package are you using?

v1.7.16

What browser are you using?

iOS 17 Safari

Reproduction URL

https://github.com/johntboyer/mobile-headlessui-minimal-reproducable

Describe your issue

As of v1.7.16, loading the reproduction page places automatic focus on the Combobox.

If you downgrade to v1.7.15 in the example using npm i @headlessui/react@1.7.15 the issue is not present.

@RobinMalfait
Copy link
Collaborator

Hey, thank you for this bug report! 🙏

This was a fun one! For a technical explanation: We don't have any code that calls .focus() on page load. But some other code we have to ensure the selection range of the input is correct uses setSelectionRange which makes the current element the focused element if it isn't yet.

Good catch, thanks!

This should be fixed by #2654, and will be available in the next release.

You can already try it using:

  • npm install @headlessui/react@insiders.
  • npm install @headlessui/vue@insiders.

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

Successfully merging a pull request may close this issue.

2 participants