Skip to content

roleTags

Reports ARIA roles that have semantic HTML element equivalents.

✅ This rule is included in the jsx logical and logicalStrict presets.

Semantic HTML elements have built-in accessibility features and better browser support than generic elements with ARIA roles. Use native HTML elements when available instead of generic elements with role attributes.

<
JSX.IntrinsicElements.div: DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>
div
HTMLAttributes<HTMLDivElement>.role?: AriaRole | undefined
role
="button" />
<
JSX.IntrinsicElements.div: DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>
div
HTMLAttributes<HTMLDivElement>.role?: AriaRole | undefined
role
="img" />
<
JSX.IntrinsicElements.span: DetailedHTMLProps<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>
span
HTMLAttributes<HTMLSpanElement>.role?: AriaRole | undefined
role
="link" />

If you are using a framework that automatically manages element interactions and/or swaps elements to their semantic counterparts, you might be able to safely disable this rule.

Made with ❤️‍🔥 around the world by the Flint team and contributors.