Skip to content

Commit 3be7dd4

Browse files
committed
docs+test: tighten allowundefined scope, add HBS test parity (Copilot review)
1 parent bcadc82 commit 3be7dd4

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

lib/rules/template-no-invalid-aria-attributes.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@ function isNumeric(value) {
1111
return !Number.isNaN(Number(value));
1212
}
1313

14-
// Per aria-query's `allowundefined` convention: some attribute definitions
15-
// (notably the 4 boolean-type attrs aria-expanded / aria-hidden / aria-grabbed
16-
// / aria-selected) mark the literal string 'undefined' as a spec-valid value
17-
// meaning "state is not applicable" (per WAI-ARIA 1.2 value table, e.g.
18-
// https://www.w3.org/TR/wai-aria-1.2/#aria-expanded). Any attribute type can
19-
// in principle accept 'undefined' via this flag.
14+
// In aria-query 5.3.2, `allowundefined: true` is set only on the four
15+
// boolean-like ARIA state attributes — `aria-expanded`, `aria-hidden`,
16+
// `aria-grabbed`, `aria-selected` — whose WAI-ARIA 1.2 value tables list
17+
// the literal string `"undefined"` as a spec-valid value meaning "state
18+
// is not applicable" (e.g. https://www.w3.org/TR/wai-aria-1.2/#aria-expanded).
19+
// The flag is nominally type-agnostic, but in practice this function only
20+
// green-lights `"undefined"` for that boolean-like subset; no non-boolean
21+
// ARIA attribute in aria-query currently sets `allowundefined`.
2022
function allowsUndefinedLiteral(attrDef, value) {
2123
return value === 'undefined' && Boolean(attrDef.allowundefined);
2224
}

tests/lib/rules/template-no-invalid-aria-attributes.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ hbsRuleTester.run('template-no-invalid-aria-attributes', rule, {
190190

191191
// aria-pressed is tristate WITHOUT allowundefined; valid values:
192192
'<button aria-pressed="true">Toggle</button>',
193+
'<button aria-pressed="false">Toggle</button>',
193194
'<button aria-pressed="mixed">Toggle</button>',
194195

195196
'<button aria-label={{if @isNew (t "actions.add") (t "actions.edit")}}></button>',

0 commit comments

Comments
 (0)