aria-role
Configuration
Rule Details
Elements with ARIA roles must use a valid, non-abstract ARIA role. A reference to role definitions can be found at WAI-ARIA.
The rule reads each JSX attribute named role (case-insensitive) on any JSX element, splits the literal value by single spaces, and reports if any space-delimited token is not a recognized non-abstract ARIA role (per aria-query's rolesMap) and is not on the user-provided allowedInvalidRoles allow-list.
Examples of incorrect code for this rule:
Examples of correct code for this rule:
Rule Options
allowedInvalidRoles
An optional array of role names that should be treated as valid in addition to the ARIA spec — useful when an application defines its own role conventions or uses non-standard roles for text-splitting.
Examples of correct code with { "allowedInvalidRoles": ["invalid-role", "other-invalid-role"] }:
ignoreNonDOM
When set to true, the rule skips elements whose resolved type is not a standard HTML element (per aria-query's dom map). Useful for designs that wrap accessibility primitives in custom components and want validation only on real DOM elements.
Examples of correct code with { "ignoreNonDOM": true }:
Examples of incorrect code with { "ignoreNonDOM": true } (a real DOM element is still checked):