Skip to content

Latest commit

 

History

History
61 lines (42 loc) · 2.02 KB

no-redundant-landmark-role.md

File metadata and controls

61 lines (42 loc) · 2.02 KB

no-redundant-landmark-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.

If a landmark element is used, any role provided will either be redundant or incorrect. This rule adds support for landmark elements, to ensure 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 (default: false) (TODO: enable by default in next major release)

References