About this AccessLint rule
A page should have only one <main> landmark. The <main> element (or a role of role="main") identifies the primary content area of the page. When a page contains more than one <main> landmark, assistive technologies cannot determine which section holds the primary content, and screen reader users lose the ability to jump directly to "the" main content with a single shortcut.
Screen readers like JAWS, NVDA, and VoiceOver provide landmark navigation that lets users skip past repeated headers, navigation bars, and sidebars to reach the main content quickly. This works well when there is exactly one <main> landmark. With two or more, the user is presented with an ambiguous list of "main" regions and has to guess which one actually contains the content they need. Keyboard-only users who rely on landmark shortcuts face the same confusion.
This rule relates to WCAG 2.1 Success Criterion 1.3.1 (Info and Relationships) at Level A. That criterion requires information and relationships conveyed through presentation to be programmatically determinable. A page layout with a single primary content area should map to a single <main> landmark so the structure is unambiguous to assistive technology.
How to fix it
- Identify all
<main>elements and elements withrole="main"in the page. - Keep only one. This element should wrap the primary content of the page.
- For other content sections that were incorrectly wrapped in
<main>, use<section>elements with descriptive headings, or other appropriate landmarks like<aside>,<nav>, or<footer>. - If the page is a single-page application that swaps views, make sure only one
<main>is present in the DOM at any given time. Remove or hide the inactive views so they are not exposed to the accessibility tree.
Examples
Incorrect: multiple <main> elements
<header>
<h1>My Site</h1>
</header>
<main>
<h2>Featured articles</h2>
<p>Article content here.</p>
</main>
<main>
<h2>Recent updates</h2>
<p>Update content here.</p>
</main>
Both content areas are marked as <main>, so a screen reader user sees two "main" landmarks with no way to tell which is the primary one.
Correct: single <main> with sections
<header>
<h1>My Site</h1>
</header>
<main>
<section>
<h2>Featured articles</h2>
<p>Article content here.</p>
</section>
<section>
<h2>Recent updates</h2>
<p>Update content here.</p>
</section>
</main>
A single <main> wraps all primary content. The two content areas are distinguished with <section> elements and their own headings, which gives screen reader users clear structure without creating duplicate landmarks.
Incorrect: mixing <main> with role="main"
<main>
<h2>Blog post</h2>
<p>Post content here.</p>
</main>
<div role="main">
<h2>Sidebar content</h2>
<p>Additional info.</p>
</div>
Even though one uses the <main> element and the other uses role="main", both register as main landmarks. The result is the same duplication problem.
Correct: one <main> and an <aside>
<main>
<h2>Blog post</h2>
<p>Post content here.</p>
</main>
<aside aria-label="Related info">
<h2>Sidebar content</h2>
<p>Additional info.</p>
</aside>
The sidebar content is placed in an <aside> element, which is the appropriate landmark for supplementary information. Only one <main> remains on the page.
Detect accessibility issues automatically
Rocket Validator scans your site with complementary accessibility engines, helping teams find issues across every page.
Help us improve our guides
Was this guide helpful?
๐
Trusted by teams worldwide
Validate at scale.
Ship accessible websites, faster.
Automated HTML & accessibility validation for large sites. Check thousands of pages against WCAG guidelines and W3C standards in minutes, not days.
Scheduled Reports
API Access
Open Source Standards
$7
/ 7 days
Pro Trial
Full Pro access. Cancel anytime.
Start Pro Trial โ
Join teams across 40+ countries