Headings and Landmarks for Web Accessibility

Headings and Landmarks for Web Accessibility

In WebAIM's 2024 survey, most screen reader respondents navigate long pages by headings first. The structural rules, the HTML5 landmark map, and a release-time audit checklist.

In WebAIM's 2024 screen reader survey, 71.6 percent of respondents said they look for information on a long page by navigating its headings first; very few (3.7 percent) start with landmarks. WCAG SC 1.3.1, 2.4.1, and 2.4.6 govern the structure they rely on. This guide covers the heading rules (one h1, no skipped levels going down), the HTML elements that map to landmark roles, the skip link pattern that satisfies SC 2.4.1, common structural mistakes in modern frontends, and a structural audit checklist.

Why structure is the first thing screen reader users use

The WebAIM Screen Reader User Survey 10 reported in 2024 that 71.6 percent of respondents first navigate a lengthy page by its headings when looking for information; using the Find feature (13.6 percent) was the next most common, and only 3.7 percent start with landmarks. Skip links, landmarks, and headings are among the techniques W3C lists for the SC 2.4.1 bypass requirement, which exists because people who navigate sequentially would otherwise have to move through the same repeated content on every page.

Sighted users skim by visual hierarchy — large type, whitespace, color. Screen reader users skim by structural hierarchy — heading levels and landmark roles. The two must align. When the visual prominence of a card title is large but the markup is <div className="card-title">, the structure is invisible to anyone navigating by H or D, and the page becomes a wall of sequential text.

Accessibility audit tickets that flag "no h1" or "three h1s on this page" or "h2 follows h4 with no h3 between" are not pedantic. They break the primary navigation tool of the user population the standard exists to serve. They are usually inexpensive to fix once found.

Headings — h1 through h6 and the rules for each

The heading rules are simple and load-bearing.

Use one <h1> per page, conveying the page topic — WCAG does not require this, and the HTML Standard asks only that, if a page has headings, at least one has level 1; a single h1 gives screen reader users one predictable place to land. The h1 is what a screen reader user lands on when pressing 1 in browse mode and is the primary signal of where they are. A page with no h1 leaves the user unable to confirm the page identity from structure alone; a page with three h1s makes that confirmation ambiguous.

The h2 elements outline the major sections of the page. The h3 elements subdivide h2 sections, h4 subdivides h3, and so on. Going down, the hierarchy must not skip levels — h2 followed by h4 with no h3 between announces "heading level 4" to a screen reader, which implies a missing parent and confuses the outline.

Going up, skipping is allowed and represents leaving a subsection. From h4 directly to h2 is normal; it means the user has finished the current subsection and started a new top-level section. Most skip-going-up bugs are not bugs at all.

The WebAIM Million 2024 found skipped heading levels on 37.9 percent of homepages and multiple h1 elements on 16.8 percent. Heading bugs are among the cheapest to fix because they are visible in source code rather than computed at runtime.

Visual styling and semantic level are separate concerns. Never pick an h-tag because it gives you the right size — pick the correct level for the document outline and style with CSS. A "small h2" is achieved with h2 { font-size: 1rem }, not by using an h4 in place of an h2 because the h4's default size matches the design.

WCAG SC 2.4.6 at AA requires that headings describe the topic of the section that follows. "Click here" or "More" or "Section 3" as a heading fails this criterion because the heading conveys nothing about what comes next. A user navigating by headings should be able to predict what each section contains from its heading alone, just as a sighted user would from a table of contents.

HTML structural elements and ARIA landmark roles

The HTML structural elements — <main>, <nav>, <header>, <footer>, <aside>, <section>, <article> — carry implicit ARIA roles, and most of them become landmarks under the conditions in the table below. Using the native element produces the landmark for free.

ElementImplicit ARIA roleNotes
``mainExactly one per page
``navigationUse for primary, secondary, breadcrumb; not for every list of links
``bannerOnly when not inside ``, ``, ``, ``, or ``, or an element with role `article`, `complementary`, `main`, `navigation`, or `region`
``contentinfoSame scoping rule as ``
``complementaryAt page or main level; inside article, aside, nav, or section only when accessibly named
``regionOnly when accessibly named
``articleSelf-contained content; a document structure role, not a landmark

Use the native HTML element first; the ARIA role= attribute is redundant on these HTML structural elements and adds noise to the accessibility tree. <main role="main"> and <nav role="navigation"> are tautological — the HTML Accessibility API Mappings specification already maps these native elements to the same roles. Reserve explicit role= for <div> wrappers in legacy components that you cannot convert to native elements.

Two rules trip up many teams.

<header> and <footer> map to banner and contentinfo landmarks only when they are not inside <article>, <aside>, <main>, <nav>, or <section>, or an element with role article, complementary, main, navigation, or region. Nested inside one of those, they are not landmarks — they are exposed, at most, as a section header or footer rather than a landmark. A page-level header with site navigation is a banner; a header inside an article element is just an article header.

<section> requires an accessible name to become a region landmark. A bare <section> with no name is just a generic container, not a landmark. Add an accessible name via aria-labelledby pointing to a heading inside the section, or via aria-label if no heading exists. Without a name, the section element accomplishes nothing for assistive technology that the surrounding <div> would not.

html
<section aria-labelledby="results-heading">
  <h2 id="results-heading">Search results</h2>
  <ol>
    <li>...</li>
  </ol>
</section>

Exactly one <main> per page. Multiple <main> elements either violate the spec (only one is allowed visible at a time) or confuse screen reader users navigating by region. Single-page applications rendering nested route layouts are a frequent source — both the layout and the page render their own <main> because the developer thought of them as independent components.

Skip links — the classic WCAG bypass mechanism

WCAG SC 2.4.1 at Level A requires a way to bypass blocks of content that repeat across pages. W3C's sufficient techniques include skip links, landmarks, and headings at the start of each section; any one of them satisfies the criterion. Adding a skip link alongside landmarks is best practice because users do not all know to look for landmarks, and a visible skip link is more discoverable.

The pattern:

html
<body>
  <a href="#main" class="skip-link">Skip to main content</a>
  <header>...</header>
  <nav>...</nav>
  <main id="main" tabindex="-1">
    <h1>Page title</h1>
    ...
  </main>
</body>
css
.skip-link {
  position: absolute;
  left: -9999px;
}
.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

The skip link is the first focusable element on the page. It hides off-screen visually until focused, then becomes visible. Activating it moves focus to the main content area, past the repeated header and navigation.

Two bugs break skip links often.

The first is targeting an element that cannot receive focus. A skip link pointing to <main id="main"> looks correct in markup, but because <main> is not natively focusable, the browser cannot focus it: under the HTML Standard, focus falls back to the viewport and only the sequential focus navigation starting point moves to <main>. The fix is tabindex="-1" on the target — that allows programmatic focus without adding the element to the tab order.

The second is permanently hidden visibility. A skip link styled with display: none or visibility: hidden is removed from the accessibility tree and the tab order entirely. Because a link hidden this way cannot receive focus, a :focus rule never reveals it; hide the link off-screen instead, as in the CSS above, and bring it back into view with :focus — if a skip link is how you meet the criterion, W3C's sufficient technique (G1) expects it to be visible at least when focused. A permanently hidden skip link can ship through automated testing because a check that the link exists in the DOM does not test whether it ever becomes visible.

For pages with primary navigation and secondary navigation (filtering, faceting), a second skip link to "Skip to filters" or "Skip to results" is a usability win. It does not satisfy a different criterion, but it materially reduces the number of Tab presses for repeat users.

Reading the heading and landmark map of a page

The fastest way to audit structure is to inspect what a screen reader sees, not what the source code says.

In NVDA, press Insert+F7 to open the elements list, then choose Headings. The list shows the headings on the page. JAWS uses Insert+F6 for the headings list and R to move to the next region (landmark); check Freedom Scientific's current keystroke list for a region list command.

In VoiceOver on macOS, the rotor (VO+U) is the unified navigator. Choose Headings from the rotor and arrow through the list; check whether your macOS version's rotor also offers a landmarks list. The rotor is a useful VoiceOver feature for structural audit.

In browser DevTools, Chrome's Accessibility tab shows the accessibility tree with landmark roles inferred from the native HTML elements. Firefox Accessibility Inspector does the same and includes a "Check for issues" linter that flags common problems.

Headingsmap and similar browser extensions visualize heading structure as a tree. Useful for visual review during authoring, especially for content authors who do not run screen readers.

What you are looking for is a sensible outline. Does the heading list summarize the page in a way a stranger would recognize? Do the landmarks describe the major regions clearly? If not, the structure is wrong even if the page passes automated checks. The automated check confirms each element exists; the structural audit confirms the elements form a coherent map.

Common structural mistakes in modern frontends

The same patterns recur across React, Vue, Svelte, and modern templating systems.

Card titles built as <div className="card-title"> instead of <h3> is a common mistake. The card looks like a heading because of font size, weight, and spacing — but it does not appear in the heading outline. Screen reader users cannot navigate to it. Fix by using the right element and styling with CSS.

Multiple <main> elements when route-based code splitting renders multiple shells. Nested layouts can end up rendering a layout <main> and a page-level <main> simultaneously; the page now has two main landmarks. Pick a single convention — main lives in the layout, never in the page, or vice versa — and enforce it through linting.

<nav> wrapping every list of links. A page can end up with, for example, five "navigation" landmarks because every footer column, sidebar, breadcrumb, and pagination control is wrapped in <nav>. Reserve <nav> for primary navigation, secondary navigation, breadcrumb, and pagination. Lists of links inside content are not navigation landmarks — they are lists.

<section> used for visual grouping without an accessible name. The developer reached for <section> because "this is a section of the page." Without a name it is exposed as a generic container, so screen readers convey nothing about it. Either add aria-labelledby pointing to a heading or downgrade to <div>.

Skip link target that scrolls but does not move focus. This can happen in client-routed applications when the router intercepts the hash navigation and prevents the default browser behavior. Test by clicking the skip link and pressing Tab once — if focus is still in the header, focus did not move and the skip link is broken. The fix is to ensure the target has tabindex="-1" and that the router does not call event.preventDefault() on hash links.

Heading levels driven by CMS visual hierarchy controls instead of document structure. Some CMS editors expose "large heading" and "medium heading" buttons that map to h2 and h3 inconsistently. Content authors pick the size that looks right, not the level the document needs. The fix is to expose level (h2 / h3 / h4) explicitly in the editor, not size, and to train authors on what the levels mean.

Single-page application caveats

Route changes in single-page applications are a place where structure can break. The browser's URL changes but the page does not reload, and screen readers do not announce the new page unless the application or framework announces it (Next.js, for example, includes a route announcer by default). Four patterns matter.

Move focus on route change. When the URL changes, focus should move to the new <main> or to the page heading, paired with a tabindex="-1" on the target so it can receive focus programmatically. The user hears the new page identity immediately rather than landing in unmoved focus on the previous link.

typescript
'use client'

import { useEffect, useRef } from 'react'
import { usePathname } from 'next/navigation'

export function PageHeading({ children }: { children: React.ReactNode }) {
  const ref = useRef<HTMLHeadingElement>(null)
  const pathname = usePathname()
  useEffect(() => {
    ref.current?.focus()
  }, [pathname])
  return (
    <h1 ref={ref} tabIndex={-1}>
      {children}
    </h1>
  )
}

Heading levels must coordinate across nested layouts. If the route layout renders an h1 and the page also renders an h1, the page now has two h1s. Pick a convention — layout never has h1, page always has h1, or vice versa — and enforce it.

Persistent landmarks across route changes. The <header> and <footer> landmarks should remain stable across routes; only <main> content should swap. This matches the user's mental model of "the same site, a new page" rather than "an entirely new layout per click."

Document title must change with the route. Use document.title directly or the framework's metadata API (for example, the Next.js Metadata API). Route announcers and screen readers rely on the title, so a stale title tells the user they are still on the previous page even though they navigated.

For deeper coverage of focus management on route changes, modal dialogs, and the inert attribute, our focus management for SPAs guide goes deeper.

A structural audit checklist

Run this on the homepage and three secondary templates per release. Structure that is correct on the homepage is often broken on other templates.

Outline the page from the rendered DOM. List every heading in source order with its level; list every landmark with its role and accessible name. The list should read like a coherent table of contents.

Verify exactly one <h1>, exactly one <main>, and at most one of each banner and contentinfo. Other landmarks (navigation, complementary, region) can occur multiple times when each has a distinct accessible name (the ARIA Authoring Practices Guide notes one rare exception: landmarks with identical content and purpose, such as the same pagination controls above and below a results list, can share one label).

Verify no skipped heading levels going down. h1 → h2 → h3 is correct; h1 → h3 is wrong. Use Insert+F7 in NVDA or the Headings rotor in VoiceOver to read the list as the screen reader sees it.

Verify every heading text describes the section that follows (SC 2.4.6). "Section 3" and "More information" are common offenders.

Verify a skip link exists, is the first focusable element, becomes visible on focus, and moves focus on activation. Click it, then press Tab once — if focus is still in the header, the skip link is broken even though it appears to scroll.

Verify the document title changes with route on every navigation. One SPA bug to look for is the title staying static while the URL and content change.

Run the same audit on three templates per release rather than running deeper audits less often. Structural bugs propagate through templates because the same components are reused across them — finding a bug in one template often means it exists in others.

Document outline is one of the cheapest accessibility wins available. The bugs are visible in source code, the fixes are mechanical, and the impact on real users is disproportionate to the engineering cost. Auditing every release catches regressions closer to the change that introduced them than an occasional periodic review does.

Project Inquiry