ariaRoleValidity
Reports invalid or abstract ARIA roles.
✅ This rule is included in the jsx logical preset.
ARIA roles must be valid according to the WAI-ARIA specification.
Abstract roles and invalid role values cannot be used, as they have no meaning to assistive technologies.
This rule reports on any DOM element given a JSX role attribute with an invalid value.
This is required for WCAG 4.1.2 compliance.
Examples
Section titled “Examples”<div role="datepicker" /><div role="range" /><div role="" /><div role="button" /><div role="navigation" /><div role={dynamicRole} /><div />When Not To Use It
Section titled “When Not To Use It”If you’re using custom ARIA roles or working with experimental features, you may need to disable this rule.
Further Reading
Section titled “Further Reading”Equivalents in Other Linters
Section titled “Equivalents in Other Linters”- ESLint:
jsx-a11y/aria-role - Oxlint:
jsx_a11y/aria-role
Made with ❤️🔥 in Boston by
Josh Goldberg and contributors.