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

Fix incorrectly focused Combobox.Input component on page load #2654

Merged
merged 2 commits into from Aug 7, 2023

Conversation

RobinMalfait
Copy link
Collaborator

This PR fixes an odd issue in the Combobox where it incorrectly focuses the Combobox.Input.

We have some code that ensures that the selection range of the Combobox.Input is correct when syncing values to the input field. However, calling setSelectionRange will actually focus the input DOM element if it is not focused yet.

This PR will only try to set the selection range if the input is the focused element.

Fixes: #2653

@vercel
Copy link

vercel bot commented Aug 7, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
headlessui-react ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 7, 2023 0:57am
headlessui-vue ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 7, 2023 0:57am

@RobinMalfait RobinMalfait changed the title Fix incorrectly focusing the Combobox.Input on page load Fix incorrectly focused Combobox.Input on page load Aug 7, 2023
@RobinMalfait RobinMalfait changed the title Fix incorrectly focused Combobox.Input on page load Fix incorrectly focused Combobox.Input component on page load Aug 7, 2023
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 this pull request may close these issues.

iOS Safari Combobox focused on page load
1 participant