roleRedundancies
Reports redundant ARIA roles on elements with implicit roles.
✅ This rule is included in the jsx logical preset.
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”<button role="button" /><img role="img" src="foo.jpg" /><nav role="navigation" /><button /><button role="presentation" /><img src="foo.jpg" /><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 ❤️🔥 in Boston by
Josh Goldberg and contributors.