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

Combobox: After leaving with "tab" key and switching the selected option outside of the Combobox, the displayed value is not updated #3537

Open
omarkohl opened this issue Oct 20, 2024 · 1 comment

Comments

@omarkohl
Copy link

omarkohl commented Oct 20, 2024

What package within Headless UI are you using?

@headlessui/react

What version of that package are you using?

2.1.10

What browser are you using?

  • Firefox 131.0.3
  • Chromium 129.0.6668.100

Reproduction URL

https://github.com/omarkohl/combobox-bug

https://codesandbox.io/p/github/omarkohl/combobox-bug/main?import=true

Describe your issue

  1. Click in the Combobox input field
  2. Select a person e.g. Arlene Mccoy using the mouse or the keyboard
  3. Use the Tab key to exit the Combobox
  4. Click on the button "Select Tanya".
  5. Observed: Tanya Fox is now the selected person but the Combobox still displays "Arlene
    Mccoy".
  6. Expected: The Combobox should display "Tanya Fox" instead.

screenshot

The issue does NOT appear if in step 3 you use the mouse to exit the Combobox e.g. by clicking somewhere else or clicking directly on the "Select Tanya" button.

omarkohl added a commit to omarkohl/phh-recorder that referenced this issue Nov 17, 2024
There seems to be a Combobox bug which causes the value being displayed
to be incorrect. This workaround solves that even though it means you
have to tab twice per Combobox when changing the value since the entire
Combobox is re-rendered I guess.

tailwindlabs/headlessui#3537
@AMirnes
Copy link

AMirnes commented Dec 11, 2024

We are also using the Combobox and are experiencing the same issue, when tabbing out of the combobox and then selecting a new value, the input does not update. Also when Shift+Tabbing out of the combobox and then selecting a new value, the input does not update. We are on version 2.2.0

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

No branches or pull requests

2 participants