Sheath rule
a11y-valid-aria-values
- Package
- Core
- Category
- Accessibility
- Default severity
- error by default
- Auto-fix
- Manual fix
#Why
ARIA uses defined boolean, tristate, token, token-list, integer, number, ID reference, ID-reference-list, and string grammars. Invalid values are ignored or mapped to a fallback state by user agents.
Static validation also enforces property-specific integer domains, including -1 for
unknown row/column/set counts, one-based indexes and levels, and zero as the
special aria-rowspan value. Numeric values must be finite.
Integer grammar is lexical rather than machine-sized: an optional sign and
leading zeroes are accepted, and very large valid integers do not overflow the
validator.
#Examples
#Bad
<div aria-busy="yes"></div>
<div aria-level="0"></div>
<div aria-valuenow="NaN"></div>
#Good
<div aria-busy="true"></div>
<div aria-level="2"></div>
<div aria-level="+002"></div>
<div aria-valuenow="12.5"></div>
<div :aria-valuenow="currentValue"></div>
<div x-bind:aria-expanded="open"></div>
<div wire:bind:aria-expanded="open"></div>
Dynamic values are not checked, including Alpine x-bind: and Livewire
wire:bind: attributes. A zero-length optional property is treated like an
absent property, as required by WAI-ARIA 1.2. An empty required property still
produces a required-property finding.