Accessibility
a11y/aria-valid
Every role value is a real WAI-ARIA role and every aria-* attribute name exists (aria-labelledby, not aria-labeledby).
seriousstaticWCAG 4.1.2 · Afe-a11y-aria
Why
Browsers ignore an unknown role or attribute without any error. The widget then has no role, no name or no state for assistive technology, while the code looks finished.
Fix
Use the role names of WAI-ARIA 1.2 (tablist, not tabs) and the exact attribute names (aria-labelledby, aria-describedby). Better still, use the native element that carries the role. Lint JSX with eslint-plugin-jsx-a11y to catch these while typing.
Examples
<!-- bad -->
<div role="tabs"><button aria-labeledby="t1">One</button></div>
<!-- good -->
<div role="tablist"><button role="tab" aria-labelledby="t1">One</button></div>Sources
Facts
- Id
a11y/aria-valid- Severity
- serious
- Check
- static checked in the source by
audit - Applies to
htmlangularvuesvelteastrojsx- WCAG 2.2
- 4.1.2, level A
- Same problem in
- axe-core
aria-roles, axe-corearia-valid-attr, Lighthousearia-roles, Lighthousearia-valid-attr - Taught by the skill
fe-a11y-ariaARIA, names and live regions- Since version
- 0.1.0
Read it in the terminal
npx github:dawidolko/frontend-skills explain a11y/aria-valid