Commit 110e21e
committed
fix(template-no-aria-hidden-on-focusable): align with ARIA 1.2 aria-hidden default
Per WAI-ARIA 1.2 §6.6 + aria-hidden value table, a missing or empty-string
aria-hidden resolves to default `undefined` — NOT `true`. Valueless
`<button aria-hidden>` and empty `<button aria-hidden="">` are therefore
NOT spec-hidden; they do not create a focus-trap anti-pattern and the
rule should not flag them.
The prior behavior inherited jsx-a11y's convention (jsx-ast-utils
coerces valueless JSX attrs to boolean true) and vue-a11y's
"anything-not-literal-false" shortcut. Both are peer-plugin conventions,
not normative ARIA interpretations. Matching ember-cli#2717's spec-first
resolution.
Also corrects the rule-doc comment: the claim attributed to WAI-ARIA 1.2
("Authors SHOULD NOT use aria-hidden='true' on any element that has
focus or may receive focus") is not in the WAI-ARIA spec. The spec only
says authors MAY "with caution" use aria-hidden. The rule's concern
(keyboard trap) comes from community/axe guidance, which this comment
now accurately attributes.
Net: flagged values are now `aria-hidden="true"` (ASCII case-insensitive),
`aria-hidden={{true}}`, and `aria-hidden={{"true"}}`. Valueless, empty,
`false`, and `{{false}}` are all accepted.1 parent cfd4c86 commit 110e21e
2 files changed
Lines changed: 28 additions & 24 deletions
File tree
- lib/rules
- tests/lib/rules
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | | - | |
20 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
21 | 26 | | |
22 | 27 | | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
70 | 73 | | |
71 | 74 | | |
72 | 75 | | |
| |||
115 | 118 | | |
116 | 119 | | |
117 | 120 | | |
118 | | - | |
| 121 | + | |
119 | 122 | | |
120 | 123 | | |
121 | 124 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
26 | 32 | | |
27 | 33 | | |
28 | 34 | | |
| |||
95 | 101 | | |
96 | 102 | | |
97 | 103 | | |
98 | | - | |
| 104 | + | |
99 | 105 | | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
| 106 | + | |
106 | 107 | | |
107 | 108 | | |
108 | 109 | | |
109 | 110 | | |
110 | | - | |
| 111 | + | |
111 | 112 | | |
112 | 113 | | |
113 | 114 | | |
| |||
0 commit comments