roleRedundancies
Reports redundant ARIA roles on elements with implicit roles.
✅ This rule is included in the jsxlogicalandlogicalStrictpresets.
HTML elements have default semantics implemented by the browser, including implicit ARIA roles. Setting an explicit role that matches the element’s implicit role is redundant and should be removed.
Examples
Section titled “Examples”<any
button role: string
role="button" /><any
img role: string
role="img" src: string
src="foo.jpg" /><any
nav role: string
role="navigation" /><any
button /><any
button role: string
role="presentation" /><any
img src: string
src="foo.jpg" /><any
nav />When Not To Use It
Section titled “When Not To Use It”If you need to explicitly set roles for documentation purposes, you may want to disable this rule.
Further Reading
Section titled “Further Reading”Equivalents in Other Linters
Section titled “Equivalents in Other Linters”- ESLint:
jsx-a11y/no-redundant-roles - Oxlint:
jsx_a11y/no-redundant-roles
Made with ❤️🔥 around the world by
the Flint team and contributors.