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

[CommandPalette] Clears on enter even with autoclear: false #113

Closed
benjamincanac opened this issue Nov 9, 2022 — with Volta.net · 2 comments
Closed

[CommandPalette] Clears on enter even with autoclear: false #113

benjamincanac opened this issue Nov 9, 2022 — with Volta.net · 2 comments
Labels
bug Something isn't working

Comments

Copy link
Member

No description provided.

@benjamincanac benjamincanac added the bug Something isn't working label Nov 9, 2022 — with Volta.net
Copy link
Contributor

@benjamincanac 2 reasons:

First, <ComboboxInput having @change="query = $event.target.value" on it, makes it clear the query on selection of an item. I'll have to dig into the component code to how it works but anyways this is this change that clears the query.

Second, even with the first point fixed we couldn't keep the query since the CommandPalette is used inside a Modal which destroys it on closing the modal. I would suggest using a useState for the query inside the CommandPalette so we retrieve the old value when recreating the it.

Copy link
Contributor

This line is what makes Combobox clear the input on selection (an exchange of triggered events between Combobox and ComboboxInput through the api). https://github.com/tailwindlabs/headlessui/blob/c0f0d433830eed15d00efb3ab255add606b0f6ed/packages/%40headlessui-vue/src/components/combobox/combobox.ts#L697

If we want to counter this behavior, it will be extremely hacky. Either put back immediately the value in the input or play with displayValue to hide that the value has been cleared.

@smarroufin smarroufin removed their assignment Dec 14, 2022
@benjamincanac benjamincanac closed this as not planned Won't fix, can't repro, duplicate, stale Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants