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

Fire user’s onChange handler when we update the combobox input value internally #1916

Merged
merged 3 commits into from Oct 10, 2022

Conversation

thecrypticace
Copy link
Contributor

@thecrypticace thecrypticace commented Oct 10, 2022

Fixes #1875

We were directly setting `.value` previously. This does not fire the onChange handler given by the user for an input element in React >= 16. However, from a user’s perspective they’re seeing the value change and not being notified which means that their state is out of sync since this works as expected when the user is typing.
@vercel
Copy link

vercel bot commented Oct 10, 2022

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

Name Status Preview Updated
headlessui-react ✅ Ready (Inspect) Visit Preview Oct 10, 2022 at 7:14PM (UTC)
headlessui-vue ✅ Ready (Inspect) Visit Preview Oct 10, 2022 at 7:14PM (UTC)

@develar
Copy link

develar commented Nov 16, 2022

Wait, but it means that both official example and example in https://tailwindui.com/components/application-ui/forms/comboboxes stopped to work.

Official examples use @change="query = $event.target.value". After this change, it means, that query is set to some item value and... when an user clicks on ComboboxButton, list doesn't contain all items, since query is not an empty string.

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.

combobox.input value gets out of sync with search term state
2 participants