Commit d7f6223
committed
fix(template-no-invalid-interactive): lean toward fewer positives on valueless aria-hidden
The valueless / empty-string aria-hidden case is genuinely contested in
the ecosystem — four positions exist (jsx-a11y / vue-a11y / axe-core /
WAI-ARIA spec), see PR body. Rather than pick one interpretation and
accept its false positives, this rule leans fewer-false-positives: any
aria-hidden form that could plausibly mean "hide this" opts the element
out of the interactive-handler check.
Escape hatch includes:
- valueless `<div aria-hidden onclick>`
- empty `<div aria-hidden="" onclick>`
- `aria-hidden="true"` / "TRUE" / "True" (ASCII case-insensitive)
- `aria-hidden={{true}}` / `{{"true"}}` (case-insensitive)
Not an escape hatch (still flags):
- `aria-hidden="false"` / `{{false}}` / `{{"false"}}` — explicit opt-in
to the check.
Reverses the previous spec-first direction on the valueless/empty case.
Rationale: flagging a handler on an author-decorated element creates
friction more often than it catches real bugs. The explicit
`aria-hidden="true"` cases, which ARE clearly hidden per spec, remain
escape hatches.
Drops unused `isMustacheLiteralTrue` helper (inlined into the escape-
hatch function).1 parent 81c5acb commit d7f6223
2 files changed
Lines changed: 41 additions & 47 deletions
File tree
- lib/rules
- tests/lib/rules
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
49 | 36 | | |
50 | 37 | | |
51 | 38 | | |
| |||
56 | 43 | | |
57 | 44 | | |
58 | 45 | | |
59 | | - | |
60 | | - | |
| 46 | + | |
| 47 | + | |
61 | 48 | | |
62 | 49 | | |
63 | | - | |
64 | | - | |
65 | | - | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
66 | 65 | | |
67 | 66 | | |
68 | 67 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
| 131 | + | |
| 132 | + | |
131 | 133 | | |
| 134 | + | |
132 | 135 | | |
| 136 | + | |
133 | 137 | | |
134 | | - | |
135 | 138 | | |
136 | 139 | | |
137 | 140 | | |
| |||
237 | 240 | | |
238 | 241 | | |
239 | 242 | | |
240 | | - | |
| 243 | + | |
241 | 244 | | |
242 | 245 | | |
243 | 246 | | |
244 | 247 | | |
245 | 248 | | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
| 249 | + | |
255 | 250 | | |
256 | 251 | | |
257 | 252 | | |
| |||
0 commit comments