-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
Bug Report
Current Behavior
The SelectContent with role="listbox"
lacks the aria-activedescendant
attribute. Instead, the aria-selected
attribute on each SelectItem element is incorrectly being set based on both its selection and focus state.
Expected behavior
The role="listbox"
element should possess an aria-activedescendant
attribute. This attribute's value must dynamically update to the id
of the option
element that is currently receiving virtual focus as the user navigates the listbox via keyboard.
Crucially, the aria-selected
attribute on option
elements should only reflect whether an item is actually selected, independent of its focus state.
Reproducible example
Suggested solution
To address this, the listbox
component's logic needs adjustment:
-
Add
aria-activedescendant
: Include thearia-activedescendant
attribute on the element withrole="listbox"
. -
Dynamic Updates: Implement logic to dynamically update the
aria-activedescendant
attribute's value to theid
of the currently "virtually focused"option
whenever a user navigates using keyboard input (e.g., arrow keys). -
Correct
aria-selected
Usage: Ensure that thearia-selected
attribute onoption
elements solely indicates a selection state and is not influenced by focus.
Additional context
Your environment
Software | Name(s) | Version |
---|---|---|
Radix Package(s) | ||
React | n/a | |
Browser | ||
Assistive tech | ||
Node | n/a | |
npm/yarn/pnpm | ||
Operating System |