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 cursor position when re-focusing the ComboboxInput component #3065

Merged
merged 4 commits into from
Mar 29, 2024

Conversation

RobinMalfait
Copy link
Member

@RobinMalfait RobinMalfait commented Mar 29, 2024

This PR improves the cursor position when re-focusing the ComboboxInput component.

What used to happen is that in some scenario's the cursor would be placed at the beginning of the input instead of at the end.

This PR fixes that, but improves it a bit more:

  1. If a selection inside the ComboboxInput was available, and you click the ComboboxButton (which blurs the input, focuses the button and then re-focuses the input), the selection is restored (as-if nothing happened).
  2. If the input was focused, and you click on an ComboboxOption, then we re-focus the ComboboxInput and place the cursor at the end of the input. This allows you to continue typing without having to move the cursor.

This is something you have to test in Chrome and Safari separately.

Copy link

vercel bot commented Mar 29, 2024

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 Mar 29, 2024 3:12pm
headlessui-vue ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 29, 2024 3:12pm

Base automatically changed from fix/improve-nullable-combobox-behaviour to main March 29, 2024 14:41
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.

2 participants