Document should not have more than one main landmark

How to fix the landmark-no-duplicate-main accessibility rule. Headings and landmarks. A best practice, not a WCAG requirement.

The message you saw

axe-core, axe DevTools and this checker
Document should not have more than one main landmark (rule landmark-no-duplicate-main)

Lighthouse has no audit for this rule, so you’ll only see it from axe-core based tools.

What it means

The page has two or more main landmarks that screen readers can reach: <main> elements, or elements with role="main". There should be one per page, around the page’s own content.

It usually comes from templates nested inside each other (the layout has a <main> and the page template adds another), or a widget that brings its own. A <main> hidden with the hidden attribute, for example the inactive views of a single-page app, isn’t counted.

Who is affected

The page has more than one main landmark, so “jump to main content” can land on the wrong one.

Screen readers’ “jump to main content” goes to the first main landmark. With two, users may land on the wrong one, or find two “main” entries in the landmarks list and not know which is the real one.

This is a best practice, not a WCAG requirement. HTML itself also allows only one visible <main>.

How to find it

  1. Run the checker: the report outlines one main landmark and lists the others.
  2. In DevTools, search the Elements panel for <main and role="main".

How to fix it

  1. Keep the outer <main> that wraps the whole content area.
  2. Change the inner ones to <div>, <section> or <article>.
  3. If you have several views and only one shows at a time, hide the others with the hidden attribute.

Example

Before

<main class="layout">
  <main class="page">…</main>
</main>

After

<main class="layout">
  <div class="page">…</div>
</main>

WCAG success criteria

None. This is a best practice: fixing it helps people using assistive technology, but it doesn’t affect WCAG conformance. Our scanner only reports it if you tick “Also show best-practice suggestions”.

Check your fix

Scan a web page and the report lists every element that fails this rule, with screenshots outlining where they are, the code, and a selector you can paste into your browser’s developer tools. Scan again after your change: when the rule no longer appears under the problems, the fix worked.

An automated pass means this rule found nothing wrong. It doesn’t prove the page is accessible: some of what WCAG asks for needs a person to check, and the report’s manual checklist lists those steps.

Related fix guides

More detail