jsx-a11y/aria-props
Disallow aria-* attributes that do not exist
fixable
Also called jsx_a11y/aria-props
Browsers and screen readers ignore an aria-* attribute they don't know. A typo such as aria-labeledby doesn't cause an error anywhere. The element loses its label, and you only find out by testing with a screen reader.
The rule checks every attribute that starts with aria-, on elements and on components.
--fix corrects five common mistakes: aria-labeledby, aria-lable, aria-sorted, aria-value and aria-role.
Configure#
Off by default. To turn it on:
bunfig.toml
[lint.rules]
"jsx-a11y/aria-props" = "error" # or "warn"Examples#
example.jsx2 problems
const name = <input aria-labeledby="name-label"aria-labeledby is not a valid ARIA attribute. />;
const menu = <button aria-open={isOpen}aria-open is not a valid ARIA attribute.>Menu</button>;example.jsxNo problems
const name = <input aria-labelledby="name-label" />;
const menu = <button aria-expanded={isOpen}>Menu</button>;