You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Yep the docs were wrong, we changed this behavior for Headless UI v2. If you focus the ListboxButton and press enter (while the Listbox is closed) then the parent form (if any) will submit.
The reason for this change is so that every form-like component can submit the form when pressing enter. If you want to open the Listbox with the keyboard, then you can still use the ⬆︎, ⬇︎ and space keys.
This has been fixed and the docs have been updated.
Not sure if this is a bug or a docs issue, but the docs for the Listbox in v2 state that "Enter" will open the Listbox, but I was not finding that to be the case in my application. Looking at the code it looks like that is not the case in the code either: https://github.com/tailwindlabs/headlessui/blob/main/packages/%40headlessui-react/src/components/listbox/listbox.tsx#L763
So I think the docs need to be updated?
The text was updated successfully, but these errors were encountered: