[aria-activedescendant]

Term side of the Card.
Topic: Relationship Attributes
Unit title: [aria-activedescendant]
Categories: Attribute
Explanation side of the Card

Explanation: The attribute that specifies the ID of the currently active descendant element within a composite widget. It helps assistive technologies know which element within a group is currently focused or selected.

Example

Wronghtml
<ul role="listbox" aria-activedescendant="opt2">
  <li id="opt1" role="option">Apple</li>
  <li id="opt2" role="option">Pear</li>
</ul>
Righthtml
<ul role="listbox" tabindex="0" aria-label="Fruit" aria-activedescendant="opt2">
  <li id="opt1" role="option">Apple</li>
  <li id="opt2" role="option" class="active">Pear</li>
</ul>

The listbox can take focus and has a name, and the active option is styled, so the virtual focus is usable.

Common mistakes

  • Setting aria-activedescendant on a <div> without tabindex, so it never gets focus.
  • Pointing at an ID that was removed after filtering, so nothing is announced.

Key points

  • DOM focus stays on the container or input, which is focusable and has a composite role.
  • The referenced ID points to an existing descendant or owned element with a role like option.
  • Arrow keys update aria-activedescendant and the active item is visually highlighted and scrolled into view.

Interview questions

aria-activedescendant vs roving tabindex: which is better?

Both work. Roving tabindex moves real focus and is widely supported. aria-activedescendant suits comboboxes where focus must stay in the input.

Does aria-activedescendant fire focus events on the item?

No. The item never gets DOM focus, so :focus styles and focus events do not apply; style it with a class.

Analytics cookiesWe'd like to use analytics cookies to see which pages are useful. They're set only if you accept. Privacy Policy