Skip to content

Select: Implement aria-activedescendant for improved accessibility #3636

@seongminn

Description

@seongminn

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:

  1. Add aria-activedescendant: Include the aria-activedescendant attribute on the element with role="listbox".

  2. Dynamic Updates: Implement logic to dynamically update the aria-activedescendant attribute's value to the id of the currently "virtually focused" option whenever a user navigates using keyboard input (e.g., arrow keys).

  3. Correct aria-selected Usage: Ensure that the aria-selected attribute on option 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions