Skip to content

useAriaActivedescendantWithTabindex (HTML)

biome.json
{
"linter": {
"rules": {
"a11y": {
"useAriaActivedescendantWithTabindex": "error"
}
}
}
}

Enforce that tabindex is assigned to non-interactive HTML elements with aria-activedescendant.

aria-activedescendant is used to manage focus within a composite widget. The element with the attribute aria-activedescendant retains the active document focus.

It indicates which of its child elements has secondary focus by assigning the ID of that element to the value of aria-activedescendant. This pattern is used to build a widget like a search typeahead select list. The search input box retains document focus so that the user can type in the input. If the down arrow key is pressed and a search suggestion is highlighted, the ID of the suggestion element will be applied as the value of aria-activedescendant on the input element.

Because an element with aria-activedescendant must be tabbable, it must either have an inherent tabIndex of zero or declare a tabindex attribute.

<div aria-activedescendant="some-id"></div>
code-block.html:1:1 lint/a11y/useAriaActivedescendantWithTabindex ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Enforce elements with aria-activedescendant are tabbable.

> 1 │ <div aria-activedescendant="some-id"></div>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 │

aria-activedescendant is used to manage focus within a composite widget.
The element with the attribute aria-activedescendant retains the active document focus.

Add the tabindex attribute to the element with a value greater than or equal to -1.

<div aria-activedescendant="some-id" tabindex="0"></div>
<input aria-activedescendant="some-id" />
<button aria-activedescendant="some-id"></button>