Skip to content

Latest commit

 

History

History
60 lines (40 loc) · 2.08 KB

no-redundant-role.md

File metadata and controls

60 lines (40 loc) · 2.08 KB

no-redundant-role

✅ The extends: 'recommended' property in a configuration file enables this rule.

🔧 The --fix option on the command line can automatically fix some of the problems reported by this rule.

The rule checks for redundancy between any semantic HTML element with a default/implicit ARIA role and the role provided.

For example, if a landmark element is used, any role provided will either be redundant or incorrect. This rule ensures that no role attribute is placed on any of the landmark elements, with the following exceptions:

Examples

This rule forbids the following:

<header role="banner"></header>
<main role="main"></main>
<aside role="complementary"></aside>
<footer role="contentinfo"></footer>
<form role="form"></form>

This rule allows the following:

<form role="search"></form>
<nav role="navigation"></nav>

Configuration

  • boolean -- if true, default configuration is applied

  • object -- containing the following property:

    • boolean -- checkAllHTMLElements -- if true, the rule checks for redundancy between any semantic HTML element with a default/implicit ARIA role and the role provided, instead of just landmark roles (default: true)

References