Commit 82e7652
committed
fix(template-require-aria-activedescendant-tabindex): accept tabindex="-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.1 parent 24882a3 commit 82e7652
3 files changed
Lines changed: 13 additions & 15 deletions
File tree
- docs/rules
- lib/rules
- tests/lib/rules
Lines changed: 6 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | | - | |
| 22 | + | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| 39 | + | |
38 | 40 | | |
39 | 41 | | |
40 | 42 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
94 | | - | |
| 94 | + | |
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
| |||
Lines changed: 6 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
16 | 22 | | |
17 | 23 | | |
18 | 24 | | |
| |||
26 | 32 | | |
27 | 33 | | |
28 | 34 | | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| |||
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | 45 | | |
50 | 46 | | |
51 | 47 | | |
| |||
0 commit comments