Rule
One main landmark
The page should have exactly one main landmark.
- Rule
landmark-one-main- Type
- Best practice, not a WCAG requirement. It runs when Best practices is switched on.
- Severity
- Moderate
What it checks
The rule counts the main landmarks on the page, <main> or role="main", including any inside open shadow roots. Hidden ones are not counted. The page passes with exactly one, and fails with none or with more than one.
Screen readers offer a command to jump to the main landmark, which lets people skip past headers and navigation. With no main there is nowhere to jump to, and with two the jump is ambiguous.
Example
Fails
<header>
<a href="/">Home</a>
</header>
<div class="content">
<h1>Opening hours</h1>
<p>Open daily from nine until five.</p>
</div>
Passes
<header>
<a href="/">Home</a>
</header>
<main>
<h1>Opening hours</h1>
<p>Open daily from nine until five.</p>
</main>
The engine is tested against both examples.
How to fix it
Wrap the page's primary content in one <main>. Where there are several, keep one and turn the others into <section> or <div>.
Check your own pages
This rule runs in every pour audit: the browser extension, the bookmarklet, the command line and the editor. Get pour, free.