Commit ec91ed0
committed
fix: template-no-invalid-interactive — honor role=presentation/none and aria-hidden as escape hatches
Premise: peer a11y plugins (jsx-a11y `hasPresentationRole` + aria-hidden
handling inside `isInteractiveElement`; vuejs-accessibility's equivalent)
treat `role="presentation"` / `role="none"` and `aria-hidden`
(boolean / "true" / `{{true}}`) as explicit opt-outs of the interactivity
contract. An element that has opted out via ARIA does not need an
interactive handler check — the handler is authored acknowledging the
element is decorative or hidden from AT.
Conclusion: wire that opt-out into `template-no-invalid-interactive`
before the native/role-based interactivity probe runs.
- Adds `hasNonInteractiveEscapeHatch(node)` covering:
- `role="presentation"` / `role="none"` (case-insensitive, trimmed,
first token of a space-separated role list — matches jsx-a11y).
- `aria-hidden` as bare boolean attribute, the text value `"true"`,
or the mustache-literal `{{true}}`. `aria-hidden="false"` does NOT
qualify.
- Visitor short-circuits on escape-hatch hit before computing interactivity.
- Tests: new valid cases for every escape-hatch shape; new invalid
cases guarding that `aria-hidden="false"` and other roles still flag.
- Audit fixture `tests/audit/no-static-element-interactions/peer-parity.js`
added to master as evidence of parity. D1 (role=presentation/none) and
D2 (aria-hidden) divergences previously documented in the Phase-3 audit
branch are now parity cases in the valid block.
Tracks PR #28 item G1 (escape-hatch awareness across interactive-handler
rules).1 parent 24882a3 commit ec91ed0
3 files changed
Lines changed: 629 additions & 1 deletion
File tree
- lib/rules
- tests
- audit/no-static-element-interactions
- lib/rules
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
5 | 9 | | |
6 | | - | |
| 10 | + | |
7 | 11 | | |
8 | 12 | | |
9 | 13 | | |
10 | 14 | | |
11 | 15 | | |
12 | 16 | | |
| 17 | + | |
| 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 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
13 | 63 | | |
14 | 64 | | |
15 | 65 | | |
| |||
174 | 224 | | |
175 | 225 | | |
176 | 226 | | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
177 | 236 | | |
178 | 237 | | |
179 | 238 | | |
| |||
0 commit comments