tailwindlabs / headlessui

Completely unstyled, fully accessible UI components, designed to integrate beautifully with Tailwind CSS.
https://headlessui.com
MIT License
26.26k stars 1.09k forks source link

When using `modal={false}` opening Combobox does not close Menu/Listbox #3512

Open emily-curry opened 1 month ago

emily-curry commented 1 month ago

What package within Headless UI are you using?

@headlessui/react

What version of that package are you using?

v2.1.9

What browser are you using?

Desktop (macOS) Chrome, Firefox, and Safari. Did not test on mobile.

Reproduction URL

https://codesandbox.io/p/devbox/heuristic-paper-7nhhcr

Describe your issue

With all popover components in headlessui, the behavior I expect is that when a popover is opened, it should close any others that are already opened, as this is the behavior that is demonstrated in most cases. However, when a Menu or Listbox is open, and I then click to open a Combobox, the Combobox opens and the Menu/Listbox does not close.

To reproduce issue this in the linked codesandbox, first open a Menu or Listbox. Then, click the ComboboxButton or ComboboxInput (immediate is set). Two popovers will be open, when only the popover for the Combobox should be open.

Interestingly, when opening a Popover first, the behavior is as expected.