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
The vast majority of Listboxes and Comboboxes use a tag list to display multiple values. Tags can be navigated with the keyboard and deleted. Example from react-select:
Since this is really common, I think it deserves a section in the docs.
Is there a pattern available for implementing an accessible tag list for the Listbox and the Combobox components? As far as I'm concerned, libraries generally use one of three approaches to make it screen-reader friendly:
If tags are being navigated, point aria-activedescendant to the tag (rather than to the entry in the listbox)
Seems to be dangerous, as headlessui already manages aria-activedescendant on its own, and uses it to point to the currently active option in the listbox.
Straight up focus the selected tag (MUI does it)
AFAIK this is a bit of an antipattern, as only components should be focusable, and sub-components should use aria-activedescendant instead
Not sure yet how it'd integrate with headlessui.
Implement raw keyboard navigation and announce events (such as the currently selected tag) with aria-live (react-select does it)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
The vast majority of Listboxes and Comboboxes use a tag list to display multiple values. Tags can be navigated with the keyboard and deleted. Example from react-select:
Since this is really common, I think it deserves a section in the docs.
Is there a pattern available for implementing an accessible tag list for the Listbox and the Combobox components? As far as I'm concerned, libraries generally use one of three approaches to make it screen-reader friendly:
aria-activedescendant
to the tag (rather than to the entry in the listbox)aria-activedescendant
on its own, and uses it to point to the currently active option in the listbox.aria-activedescendant
insteadaria-live
(react-select does it)Beta Was this translation helpful? Give feedback.
All reactions