Skip to content

STR-004 Build the page's regions from landmark elements, and name repeated ones apart

Level
Rule
Verdict
Unanimous (2 of 2)
Status
proposed, version 1.0.0

Rule

Build the page's regions from landmark elements: the main content in main, the top bar in header, each group of navigation links in nav and the bottom bar in footer. When a page has more than one nav, give each a name that tells them apart.

Examples

Live examples built with Justified's components. Try them with the mouse, the keyboard or a screen reader.

Do: Regions are landmarks, navs are named

<header>Ridgeway · Account menu

<nav aria-label="Main">Projects · Reports

<nav aria-label="Projects">Spring launch · Autumn sale

<main>The view

<footer>Help · Status

Simulated: the landmark list a screen reader would build from this page's code:

  1. banner, no name
  2. navigation, named “Main”
  3. navigation, named “Projects”
  4. main, no name
  5. contentinfo, no name

Press Next landmark. It goes from the top bar to each of the two navigation lists, named Main and Projects, then to the one main and the footer. The screen reader adds "navigation" itself, so the names do not.

Don't: A shell built from divs

<div>Ridgeway · Account menu

<div>Spring launch · Autumn sale

<div>The view

<div>Help · Status

Simulated: the landmark list a screen reader would build from this page's code:

No landmarks. A person who lists them finds nothing.

Same shell and same looks, but every region is a div. The landmark list is empty, so there is nothing to jump between and a person passes every link on the way to the content.

Don't: Two navs with no names

<header>Ridgeway · Account menu

<nav>Projects · Reports

<nav>Spring launch · Autumn sale

<main>The view

<footer>Help · Status

Simulated: the landmark list a screen reader would build from this page's code:

  1. banner, no name
  2. navigation, no name
  3. navigation, no name
  4. main, no name
  5. contentinfo, no name

The landmarks are all there, but both lists of links are announced as just "navigation". The person has to try each one to find the menu they wanted.

Don't: A second main

<header>Ridgeway · Account menu

<nav aria-label="Main">Projects · Reports

<nav aria-label="Projects">Spring launch · Autumn sale

<main>The shell's inset

<main>The page's own main

<footer>Help · Status

Simulated: the landmark list a screen reader would build from this page's code:

  1. banner, no name
  2. navigation, named “Main”
  3. navigation, named “Projects”
  4. main, no name
  5. main, no name
  6. contentinfo, no name

The shell's inset already renders a main, and the page adds another inside it. A page has one, so the list offers two and neither is clearly the content.

Why

A screen reader can list a page's landmarks and jump straight to one, so a person can go from the top bar to the main content in one step instead of passing every link on the way. That only works when the regions are built from landmark elements. A page made of divs has no regions to jump to. Two navigation landmarks that are both announced as "navigation" leave the person to try each one to find the menu they wanted.

No WCAG criterion requires landmarks. The Working Group lists them as a sufficient technique (ARIA11) for two criteria. Under WCAG 2.2, 1.3.1 Info and Relationships they are one way to make the page's regions readable from the code. Under 2.4.1 Bypass Blocks they are one of several ways to let people get past blocks that repeat on every page, such as a header and a sidebar (Understanding 2.4.1). A correct main is therefore one way to meet 2.4.1, not the only one. A page can meet both criteria without landmarks.

Do

  • In the project tool Ridgeway, the app shell is a header with the product name and the account menu, a sidebar with a nav, the view in main, and a footer with the links Help and Status.
  • Keep one main on each page. In shadcn, SidebarInset already renders main, so put the view's content inside it and do not add another main in the page.
  • In shadcn's sidebar blocks, the header sits inside SidebarInset, so it is part of main and not the page's top bar. Move a top bar that spans the product outside SidebarInset, or treat the inner header as the view's own.
  • shadcn's Sidebar renders divs. Wrap the SidebarMenu that holds links in a nav.
  • The page has a nav in the top bar, one in the sidebar and a breadcrumb trail. Name them "Main", "Projects" and "Breadcrumb", with aria-label or with aria-labelledby pointing to a visible heading. The screen reader adds "navigation" itself, so the name does not repeat it. shadcn's Breadcrumb already renders nav aria-label="breadcrumb", so it needs no wrapper of its own.
  • A sign-in page with no header still puts its form in main.
  • A chat panel docked beside the view is an aside with a name, such as "Team chat".
  • Our own advice: name any other landmark that appears more than once too, such as two asides or two named sections, so each can be told apart.
  • Our own advice, which ARIA11 also suggests: put all content inside some landmark, so a person moving by landmark misses nothing. The skip link is the one exception: NAV-004 keeps it on its own before the regions.
  • A skip link is a second route past the repeated blocks, for people who use a keyboard without a screen reader. It is outside this rule; NAV-004 is our guideline for it.
  • Use the native elements. role="main" on a main element does no harm, but it adds nothing.
  • A search form may use the search element or role="search". That is optional.
  • Name a section only when it is a region people will want to jump to, such as Activity on a project page. A named section becomes a landmark; one without a name does not.

Don't

  • Build the shell as <div className="flex min-h-screen"> with a div for the top bar, a div for the sidebar and a div for the content.
  • Add <main> inside a page that is already rendered inside SidebarInset, so the page has two.
  • Put the view's content beside SidebarInset instead of inside it, so it falls outside main.
  • Leave the top bar's nav and the sidebar's nav without names, so both are announced as "navigation" and nothing else.
  • Name a nav "Main navigation nav" or "Sidebar navigation menu".
  • Give every section on the page an aria-label, so the landmark list fills up with regions nobody jumps to.

Exceptions

  • Header and footer inside content. A header or footer inside an article or a section belongs to that part and is not the page's top or bottom bar. That is correct HTML. Only the ones at the top level of the page become its banner and its footer landmark.
  • Dialogs. A dialog is not a landmark. While it is open it sits outside the page's main.
  • Not covered here. The order of regions in the code is LAY-002. The h1 inside main is STR-003.

Verdict

Unanimous (2 of 2). Only the judges decide; the expert witnesses are shown but do not vote. How verdicts work

Stances on STR-004
SourceRoleStancePage
WCAG 2.2LawSupports1.3.1 Info and Relationships
WCAG 2.2LawSupports2.4.1 Bypass Blocks
Material DesignJudge SupportsAccessibility designing: structure
Apple Human Interface GuidelinesJudge No position
Carbon Design SystemJudge SupportsAccessibility: Developers
Global header
UI shell header: Accessibility
GOV.UK Design SystemExpert witness SupportsPage template
Skip link
Nielsen Norman GroupExpert witness No position

Each stance links to the page it rests on, read on the date in the source register. This page never repeats what a source says; read the source itself.

History

  • Version 1.0.0, : First version.

Last checked against the other rules for conflicts on .

More in Page structure: 7 rules and 1 guideline · All rules