Skip to content

BUGFIX: accept tabindex="-1" in template-require-aria-activedescendant-tabindex#2714

Merged
NullVoxPopuli merged 1 commit intoember-cli:masterfrom
johanrd:fix/aria-activedescendant-accept-tabindex-neg1
Apr 21, 2026
Merged

BUGFIX: accept tabindex="-1" in template-require-aria-activedescendant-tabindex#2714
NullVoxPopuli merged 1 commit intoember-cli:masterfrom
johanrd:fix/aria-activedescendant-accept-tabindex-neg1

Conversation

@johanrd
Copy link
Copy Markdown
Contributor

@johanrd johanrd commented Apr 21, 2026

Fix: extend the accepted range from >= 0 to >= -1. Matches eslint-plugin-jsx-a11y (aria-activedescendant-has-tabindex.js: if (tabIndex >= -1) return;) and eslint-plugin-lit-a11y.

Three test cases moved from invalid to valid; rule doc updated to describe the new accepted range.

Upstream [email protected] has the same false positive.

…="-1"

Before: any tabindex below 0 was flagged, and the autofix replaced
tabindex="-1" with tabindex="0". That silently changed semantics — -1 is
the canonical "focusable but not in tab order" value that composite
widgets with aria-activedescendant specifically want.

tabindex semantics:
  "0"  — focusable, in the natural tab order
  "-1" — focusable programmatically (e.g. via roving focus), skipped in
         tab order

Both are valid for elements that manage focus via aria-activedescendant;
see the W3C APG entry on "Managing focus in composites using
aria-activedescendant":
  https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/#kbd_focus_activedescendant

Matches the check upstream in eslint-plugin-jsx-a11y
(aria-activedescendant-has-tabindex.js: `if (tabIndex >= -1) return;`).
lit-a11y's aria-activedescendant-has-tabindex has the same semantics.

Rule doc updated to describe the new accepted range. Tests moved the
three tabindex="-1" cases from invalid to valid.
@johanrd johanrd closed this Apr 21, 2026
@johanrd johanrd reopened this Apr 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants