roleSupportedAriaProps
Reports ARIA properties that are not supported by an element's role.
✅ This rule is included in the jsxlogicalandlogicalStrictpresets.
Elements with ARIA roles should only use ARIA properties that are supported by that role. Each ARIA role has a specific set of supported properties defined in the WAI-ARIA specification. Using ARIA properties that are not supported by a role can confuse assistive technologies and lead to unexpected behavior.
For example, the checkbox role supports properties like aria-checked and aria-required, but not aria-selected.
Similarly, the button role supports aria-pressed and aria-expanded, but not aria-checked.
This is required for WCAG 4.1.2 compliance.
Examples
Section titled “Examples”<JSX.IntrinsicElements.div: DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>
div HTMLAttributes<HTMLDivElement>.role?: AriaRole | undefined
role="button" AriaAttributes["aria-checked"]?: boolean | "true" | "false" | "mixed" | undefined
Indicates the current "checked" state of checkboxes, radio buttons, and other widgets.
aria-checked="true" /><JSX.IntrinsicElements.div: DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>
div HTMLAttributes<HTMLDivElement>.role?: AriaRole | undefined
role="link" AriaAttributes["aria-selected"]?: Booleanish | undefined
Indicates the current "selected" state of various widgets.
aria-selected="true" /><JSX.IntrinsicElements.button: DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>
button AriaAttributes["aria-checked"]?: boolean | "false" | "mixed" | "true" | undefined
Indicates the current "checked" state of checkboxes, radio buttons, and other widgets.
aria-checked="false" /><JSX.IntrinsicElements.div: DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>
div HTMLAttributes<HTMLDivElement>.role?: AriaRole | undefined
role="button" AriaAttributes["aria-pressed"]?: boolean | "true" | "false" | "mixed" | undefined
Indicates the current "pressed" state of toggle buttons.
aria-pressed="true" /><JSX.IntrinsicElements.div: DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>
div HTMLAttributes<HTMLDivElement>.role?: AriaRole | undefined
role="checkbox" AriaAttributes["aria-checked"]?: boolean | "true" | "false" | "mixed" | undefined
Indicates the current "checked" state of checkboxes, radio buttons, and other widgets.
aria-checked="true" /><JSX.IntrinsicElements.button: DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>
button AriaAttributes["aria-pressed"]?: boolean | "true" | "false" | "mixed" | undefined
Indicates the current "pressed" state of toggle buttons.
aria-pressed="true" />When Not To Use It
Section titled “When Not To Use It”If you use a framework that automatically changes ARIA properties from custom invalid ones to correct roles, you might need to disable this rule.