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 change event incorrectly getting called on blur #2296

Merged
merged 4 commits into from
Feb 21, 2023
Merged

Conversation

RobinMalfait
Copy link
Member

This PR fixes an odd bug where blurring the input field would call the @change event on the ComboboxInput, this ins turn sets the query.value and therefore a list of data would be (incorrectly) filtered again because we expected query.value === ''.

Internally we set the onChange to a handler that just re-emitted the change event, but Vue already does that for you.

Fixes: #2171

This was only used in tests and doesn't seem to be necessary.
This only emitted a `change` event, which Vue already emits as well.
This is an odd one. In Chrome this means that the `@change` is still
being called, but if we keep it, then the `@change` is _also_ called on
blur resulting in odd bugs.

Droping it fixes that issue.

That said, the `@change` is _still_ emitted and therefore the callback
is properly called and the `ComboboxInput` still can interact with the
`@change` event.
@vercel
Copy link

vercel bot commented Feb 21, 2023

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

Name Status Preview Comments Updated
headlessui-react ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Feb 21, 2023 at 11:17AM (UTC)
headlessui-vue ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Feb 21, 2023 at 11:17AM (UTC)

@RobinMalfait RobinMalfait changed the title Fix change event incorrectly getting called on blur Fix change event incorrectly getting called on blur Feb 21, 2023
@RobinMalfait RobinMalfait merged commit 569cec7 into main Feb 21, 2023
@RobinMalfait RobinMalfait deleted the fix/issue-2171 branch February 21, 2023 11:19
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 options remain filtered after selecting an option with Enter
1 participant