Combobox
The Combobox component allows users to choose one option from a collapsed dropdown, filter options by typing, or create a new one.
See Accessibility in Design Foundations for explanations of key concepts and best practices.
Strato's Combobox component follows the ARIA combobox pattern. The text input is the combobox, and the dropdown is a list of options. Screen readers announce the active option while focus stays on the input.
Accessible names and roles
- Do verify that the visible label matches the accessible name, if a visible label is present. Wrapping the
Comboboxin aFormFieldwith aLabelhandles this for you. - Do provide an
aria-labelthat describes the purpose of the field in its context, if no visible label is present. - Do provide an
aria-labelon aCombobox.Optionif its content isn't descriptive enough for screen readers, for example when it contains only an icon.
Keyboard accessibility and focus
The Combobox handles focus management out of the box. Focus stays in the input while the dropdown is open, and the active option is announced. When users press Tab, the Combobox commits the typed text and moves focus to the next element.
- Don't override the built-in focus handling. The active option must stay announced so screen readers can track the user's position in the list.
State announcements
The Combobox announces its state out of the box. It sets aria-expanded to true when the dropdown is open and to false when it's closed.
- Do provide a hint or error message through
FormFieldso validation results are announced together with the field. - Do make the effect of creating a value clear in the label or hint, so screen reader users know that entering new text is possible.