Files
headlessui/packages/@headlessui-react
Robin Malfait 419ffdac2d Ensure that there is always an active option in the Combobox (#1279)
* ensure that the first option is always active

This will ensure that the first non-disabled option is the active one if
no other active options exist. This means that any time you search for
something that the first result is the active one and you can just press
<kbd>Enter</kbd> to activate the option.

However, there are a few rules that we have to take into account:
- If you just open the Combobox, and there is a `selected`
  Combobox.Option, then we can't make the first option the active one.
  The first selected Combobox.Option has precedence over this one. This
  is important and rather tricky because Combobox.Option's register
  themselves at some point (later) in time.
- If you already have an active option, then that option should stay
  active. If it changes position, then the activeOptionIndex is adjusted
  to account for that.
- If you "mouse leave" an option, then no option should be active. It
  will be re-enabled the moment you start typing OR if you re-open the
  Combobox. Otherwise, it can happen that you are at the bottom of the
  list, mouse leave, and we scroll all the way back up to make the first
  item the active one which is not good for UX reasons.

* filter list based on query in the playground

* update changelog
2022-03-29 15:30:10 +02:00
..
2022-01-31 00:10:06 +01:00
2022-01-31 12:29:27 +01:00
2022-03-09 11:24:45 +01:00

@headlessui/react

A set of completely unstyled, fully accessible UI components for React, designed to integrate beautifully with Tailwind CSS.

Total Downloads Latest Release License

Installation

# npm
npm install @headlessui/react

# Yarn
yarn add @headlessui/react

Documentation

For full documentation, visit headlessui.dev.

Community

For help, discussion about best practices, or any other conversation that would benefit from being searchable:

Discuss Headless UI on GitHub

For casual chit-chat with others using the library:

Join the Tailwind CSS Discord Server