oxc-project/oxc · error

Elements with `aria-activedescendant` must be tabbable.

Error message

Elements with `aria-activedescendant` must be tabbable.

What it means

Fires from jsx-a11y/aria-activedescendant-has-tabindex when an element sets aria-activedescendant (which delegates focus to a descendant) but is not itself tabbable. The run visitor checks such elements and the helper advises adding a tabindex (typically 0) to the named element.

Source

Thrown at crates/oxc_linter/src/rules/jsx_a11y/aria_activedescendant_has_tabindex.rs:18

use oxc_ast::{
    AstKind,
    ast::{JSXAttribute, JSXAttributeItem, JSXElementName},
};
use oxc_diagnostics::OxcDiagnostic;
use oxc_macros::declare_oxc_lint;
use oxc_span::Span;

use crate::{
    AstNode,
    context::LintContext,
    globals::HTML_TAG,
    rule::Rule,
    utils::{get_element_type, has_jsx_prop_ignore_case, is_interactive_element, parse_jsx_value},
};

fn aria_activedescendant_has_tabindex_diagnostic(span: Span, el_name: &str) -> OxcDiagnostic {
    OxcDiagnostic::warn("Elements with `aria-activedescendant` must be tabbable.")
        .with_help(format!("Add a `tabindex` attribute to this {el_name}."))
        .with_label(span)
}

#[derive(Debug, Default, Clone)]
pub struct AriaActivedescendantHasTabindex;

declare_oxc_lint!(
    /// ### What it does
    ///
    /// Enforce elements with aria-activedescendant are tabbable.
    ///
    /// ### Why is this bad?
    ///
    /// Elements with `aria-activedescendant` must be tabbable for users to
    /// navigate to them using keyboard input. Without proper tabindex, screen
    /// reader users cannot access the element through keyboard navigation,
    /// making the functionality inaccessible.

View on GitHub (pinned to e1e7af627c)

Solutions

  1. Add `tabIndex="0"` (or an appropriate non-negative value) to the element
  2. Remove `aria-activedescendant` if the element is not managing focus
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/oxc_linter/src/rules/jsx_a11y/aria_activedescendant_has_tabindex.rs:18 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of oxc-project/oxc@e1e7af627c (2026-08-20). Data as JSON: /api/errors/31e443cc8ae94d75. Report an issue: GitHub.