React fix

Before and after

Broken — before
// src/components/AppShell.tsx (Broken React SPA shell with only <div> containers)
import { Outlet } from "react-router-dom";

export function AppShell() {
  return (
    <div className="app-shell">
      <div className="top-bar">Top Navigation</div>
      <div className="content-area">
        <Outlet />
      </div>
    </div>
  );
}
Fixed — after
// src/components/AppShell.tsx (Fixed semantic landmarks: <header>, <main>, <footer>)
import { Outlet } from "react-router-dom";

export function AppShell() {
  return (
    <div className="app-shell">
      <a href="#main-content" className="skip-link">
        Skip to main content
      </a>
      <header className="top-bar">
        <nav aria-label="Primary">Top Navigation</nav>
      </header>
      <main id="main-content" tabIndex={-1} className="content-area">
        <Outlet />
      </main>
      <footer className="site-footer">© 2026 Acme Inc.</footer>
    </div>
  );
}
Live preview

Fixed vs. broken example

Passes landmark-one-main
Accessibility tree: Landmarks list: banner (<header>), main (<main id="main-content">)

Pair your single <main id="main-content" tabindex="-1"> landmark with a visible-on-focus "Skip to main content" link at the top of <body>.

Automated test

Playwright + axe-core check

tests/a11y-landmark-one-main.spec.ts
import { test, expect } from "@playwright/test";
import AxeBuilder from "@axe-core/playwright";

test("React SPA layout exposes one <main> landmark across routes", async ({ page }) => {
  await page.goto("/projects");
  await expect(page.getByRole("main")).toHaveCount(1);
  const results = await new AxeBuilder({ page })
    .withRules(["landmark-one-main"])
    .analyze();
  expect(results.violations).toEqual([]);
});

Template deduplication tip

Fixing your top-level <AppLayout /> shell once resolves landmark-one-main across every client-side route in your React application.

Screen readers

What NVDA and VoiceOver announce

Keyboard and screen-reader users rely on the <main> landmark (and Skip-to-Content links targeting it) to bypass 30+ repeating header, mega-menu, and announcement links on every page navigation.

NVDA (Windows)

Broken

Pressing D (next landmark) announces: "no next landmark"


Fixed

Pressing D jumps straight past navigation and announces: "main landmark"

VoiceOver (macOS / iOS)

Broken

Landmarks rotor shows no Main region; user must step through every header link.


Fixed

Landmarks rotor lists "main", letting the user jump directly to primary content.

Common questions

Why should a React SPA keep <main> outside <Routes> / <Outlet>?
Placing <main> once in your persistent <AppShell> guarantees no child route forgets it and prevents nested <main> elements when rendering sub-routes.
Should React move focus to <main> on client-side route transitions?
Managing focus on SPA navigation (either to the new page's <h1> or <main tabIndex={-1}>, or announcing route changes via an aria-live region) prevents keyboard focus from getting stranded on an unmounted link.
Can a React modal portal render a second <main>?
Never—modals should use native <dialog> or role='dialog' aria-modal='true', leaving the underlying page with a single <main> landmark.