Commit de1838b
committed
fix(template-require-context-role): broaden hasAriaHiddenTrue via classifyAttribute (rows h3, h7, h12, h14)
Before:
- `hasAriaHiddenTrue` matched only `aria-hidden="true"` as a `GlimmerTextNode`.
- Mustache forms that render the same `aria-hidden="true"` at runtime were
silently treated as visible:
- `aria-hidden={{"true"}}` (h7) → renders `aria-hidden="true"`
- `aria-hidden="{{true}}"` (h12) → renders `aria-hidden="true"`
- `aria-hidden="{{'true'}}"` (h14) → renders `aria-hidden="true"`
- Each was a false positive: a child with role="treeitem" inside a hidden
ancestor was reported as missing-context, even though the entire subtree
is hidden from assistive tech and "context" is moot.
After:
- `hasAriaHiddenTrue` flows through `classifyAttribute` from the new util.
The check is `presence === 'present' && value === 'true'`, which matches
exactly h3 / h7 / h12 / h14 — every source form whose IDL `ariaHidden` is
`"true"`.
- Note: h5 (bare `{{true}}`) renders `aria-hidden=""` (contested per ARIA
spec), so `classifyAttribute` returns `value=""` for that form and the
equality check correctly excludes it. The rule deliberately does not
treat the contested empty-value case as hidden.
Test additions in both GJS and HBS suites:
- Valid: `<div aria-hidden={{"true"}} role="tablist"><div role="treeitem">…`
- Valid: `<div aria-hidden="{{true}}" role="tablist"><div role="treeitem">…`
- Valid: `<div aria-hidden="{{'true'}}" role="tablist"><div role="treeitem">…`
111 tests pass. Doc rows cited: h3 (existing), h7, h12, h14.1 parent fcd1fdd commit de1838b
2 files changed
Lines changed: 26 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
1 | 5 | | |
2 | 6 | | |
3 | 7 | | |
| |||
89 | 93 | | |
90 | 94 | | |
91 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
92 | 104 | | |
93 | 105 | | |
94 | | - | |
| 106 | + | |
| 107 | + | |
95 | 108 | | |
96 | 109 | | |
97 | 110 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
59 | 67 | | |
60 | 68 | | |
61 | 69 | | |
| |||
321 | 329 | | |
322 | 330 | | |
323 | 331 | | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
324 | 336 | | |
325 | 337 | | |
326 | 338 | | |
| |||
0 commit comments