Commit 25bb75b
committed
fix: template-no-invalid-aria-attributes — accept "undefined" as valid token for aria-orientation
Per aria-query 5.3.2, `aria-orientation` has `type: 'token'` with
`values: ['vertical', 'undefined', 'horizontal']` — i.e. the literal
string "undefined" is an explicit, valid token.
Our previous implementation short-circuited on `value === 'undefined'`
by returning `Boolean(attrDef.allowundefined)` before the token check.
Because `aria-orientation` carries `allowundefined: false` in aria-query,
the valid token "undefined" was incorrectly rejected.
Fix: before applying the generic `allowundefined` shortcut, check
whether the attribute is a `token`/`tokenlist` whose `values` array
explicitly includes `'undefined'`. If so, the value is valid regardless
of `allowundefined`.
Regression tests cover the valid (`undefined`, `horizontal`) and invalid
(`sideways`) cases for `aria-orientation`, in both `<template>` and hbs
parsers.
Reference: audit finding B9 (tests/audit/aria-props/peer-parity.js on
audit/phase3/aria-props); PR #28 backlog item F1.1 parent 24882a3 commit 25bb75b
2 files changed
Lines changed: 27 additions & 0 deletions
File tree
- lib/rules
- tests/lib/rules
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
20 | 33 | | |
21 | 34 | | |
22 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
| 36 | + | |
35 | 37 | | |
36 | 38 | | |
37 | 39 | | |
| |||
121 | 123 | | |
122 | 124 | | |
123 | 125 | | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
124 | 131 | | |
125 | 132 | | |
126 | 133 | | |
| |||
150 | 157 | | |
151 | 158 | | |
152 | 159 | | |
| 160 | + | |
| 161 | + | |
153 | 162 | | |
154 | 163 | | |
155 | 164 | | |
| |||
223 | 232 | | |
224 | 233 | | |
225 | 234 | | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
226 | 240 | | |
227 | 241 | | |
0 commit comments