[combobox] Allow automatic selection of first option
See original GitHub issue🚀 Feature request
Current Behavior
While typing into a ComboboxInput
, no ComboboxOption
elements are selected.
Desired Behavior
While typing into a ComboboxInput
, there should be an optional behavior to allow the first ComboboxOption
element to be automatically selected.
Suggested Solution
Example 2: List Autocomplete with Automatic Selection from the official ARIA examples shows the intended behavior: https://www.w3.org/TR/wai-aria-practices/examples/combobox/aria1.1pattern/listbox-combo.html
Adding an autoSelectFirstOption?: boolean
prop to the Combobox
component would be a convenient solution.
Who does this impact? Who is this for?
This impacts users looking to implement smoother auto-completion flows with a combobox.
Describe alternatives you’ve considered
I have considered manually calling focus()
on a ref of the first ComboboxOption
but this does not result in the element being selected.
Additional context
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:9 (1 by maintainers)
Top GitHub Comments
Working on it.
@logeekal we’ve faced the exact same UX issue.
in our humble opinion option 2 is more user-friendly.
thanks so much for working on it! 😃