SiteLint documentation and guidelines

The main element should only be defined once on a page

Description

Each page must have no more than one <main> landmark, used to identify the main content.

Purpose

The <main> element behaves like a main landmark role. It provides a navigation point to the primary content of the page for users of assistive technologies. The content of a <main> element should be unique to the document. The HTML specification says:

The <main> element represents the dominant contents of the document. A document must not have more than one main element that does not have the hidden attribute specified.

Examples of correct code for this rule:

<main></main>

How to fix it

  • Keep only one <main> element on the page.
  • Prefer using the <main> element over declaring role="main", unless there are legacy browser support concerns.

WCAG Success Criteria

  1. 2.4.1 Bypass Blocks (Level A, Primary Success Criterion)

Rule

  • Audit: Accessibility.
  • Standard: SiteLint.
  • Level: Not applicable.
  • Success Criteria: Not applicable
  • ID: main-element-only-one