Commit 84108aa
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 44f0e94 commit 84108aa
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 | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
45 | 32 | | |
46 | 33 | | |
47 | 34 | | |
| |||
52 | 39 | | |
53 | 40 | | |
54 | 41 | | |
55 | | - | |
56 | | - | |
| 42 | + | |
| 43 | + | |
57 | 44 | | |
58 | 45 | | |
59 | | - | |
60 | | - | |
61 | | - | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
62 | 61 | | |
63 | 62 | | |
64 | 63 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
| 125 | + | |
| 126 | + | |
125 | 127 | | |
| 128 | + | |
126 | 129 | | |
| 130 | + | |
127 | 131 | | |
128 | | - | |
129 | 132 | | |
130 | 133 | | |
131 | 134 | | |
| |||
231 | 234 | | |
232 | 235 | | |
233 | 236 | | |
234 | | - | |
| 237 | + | |
235 | 238 | | |
236 | 239 | | |
237 | 240 | | |
238 | 241 | | |
239 | 242 | | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
| 243 | + | |
249 | 244 | | |
250 | 245 | | |
251 | 246 | | |
| |||
0 commit comments