MAIN element must be a top-level landmark
Description
The <main> element represents the primary content area of a webpage – the part that is directly related to the central topic or purpose of the page.
The <main> landmark must appear only once per page and must not be nested inside any other landmark region
(such as <header>, <nav>, <aside>, <footer>, or ARIA landmark roles like role="region" or role="complementary").
When the <main> element is nested inside another landmark, assistive technologies may misinterpret the page structure, making navigation more difficult for users who rely on landmark shortcuts.
Disabilities impacted
- Visual impairments: users who navigate via screen readers depend on correctly structured landmarks to move efficiently through a page. A nested
<main>landmark disrupts this navigation. - Cognitive disabilities: predictable and consistent page structure helps users understand and orient themselves within the content.
- Motor impairments: users who rely on keyboard or switch-based navigation benefit from accurate landmark regions that reduce the number of keystrokes needed to reach primary content.
Why it matters
Landmarks provide a structural map of a webpage. Assistive technologies allow users to jump directly to key regions such as navigation, search, and main content.
If the <main> landmark is incorrectly nested, it may not be recognized as the primary content region, forcing users to navigate through unnecessary elements or landmarks.
This increases cognitive load, reduces efficiency, and can lead to confusion or frustration.
Coding problems and solutions
Common coding problems
- Nesting
<main>inside another landmark: placing the main content inside<header>,<nav>,<aside>,<footer>, or any ARIA landmark role. - Multiple nested containers with landmark roles: wrapping
<main>inside a<div role="region">or similar container. - Using layout components that unintentionally introduce landmark roles: some frameworks add ARIA roles automatically, causing accidental nesting.
How to fix it
Ensure <main> is a top-level landmark
Place the <main> element directly inside the <body> element, not inside any other landmark.
<body>
<header>...</header>
<nav>...</nav>
<main>
<h1>Page Title</h1>
<p>Primary content goes here.</p>
</main>
<footer>...</footer>
</body><body>
<header>
<main>
<h1>Page Title</h1>
</main>
</header>
</body>Avoid wrapping <main> in ARIA landmark roles
Ensure no parent element of <main> has a landmark role.
<body>
<main>...</main>
</body><body>
<div role="region">
<main>...</main>
</div>
</body>Check framework components for implicit roles
Some UI libraries add ARIA roles automatically. Review component markup to ensure <main> remains top-level.
Known limitations
- Dynamic layouts: content injected by JavaScript may unintentionally wrap
<main>inside a landmark container. - Third‑party components: layout or template systems may introduce ARIA roles without clear documentation.
- Single‑page applications: routing frameworks may re-render content inside containers that have landmark roles.
Resources
- MDN Web Docs – main element
- WAI-ARIA Authoring Practices – Landmarks
- WCAG 2.1 – 1.3.1 Info and Relationships
Rule
- Audit: Accessibility
- Standard: WCAG
- Level: A
- Success Criteria: 1.3.1
- ID:
main-landmark-must-be-top-level