a11y: Add main and region landmarks - #1996
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
marcleblanc2
marked this pull request as ready for review
September 17, 2026 09:11
burmudar
approved these changes
Sep 17, 2026
marcleblanc2
enabled auto-merge (squash)
September 17, 2026 09:56
axe-core flags every page with landmark-one-main and region violations (moderate): there is no <main>, so page content sits outside any landmark and screen reader users cannot jump to it. Make the page content container a <main> on the home, docs and 404 pages, and make the home page hero a <section> labelled by its heading. Both keep their classes, so the layout does not change. Amp-Thread-ID: https://ampcode.com/threads/T-01a0ae7e-ae2c-7423-be36-eb9c5884b1e0 Co-authored-by: Amp <amp@ampcode.com>
marcleblanc2
force-pushed
the
marc/a11y/landmarks
branch
from
September 17, 2026 09:56
236c7c4 to
a2875e8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
axe-core flags every page with
landmark-one-main(1 node) andregion(19 nodes on the home page, 66 on a docs page), both impact: moderate. There is no<main>, so all page content sits outside any landmark and screen reader users cannot jump straight to it.Fix
<div>becomes<main>on the home page (page.tsx), docs pages ([...slug]/page.tsx) and the 404 page (not-found.tsx). It keeps its classes, so it stays a flex sibling of the sidebar and TOC and the layout does not change.Herobecomes a<section aria-labelledby="hero-title">, so its heading and intro text are inside a named region.I chose this over wrapping
{children}inLayout.tsxbecausechildrenis a fragment of flex siblings (content + TOC); wrapping it would have broken the three-column layout, and would have put the sidebar<nav>inside<main>.Verification
axe-core 4.12 via Playwright against a local
next dev, on/,/admin/audit-logand a 404 URL, light and dark:landmark-one-mainandregiongo to 0 on all six runs.Home page screenshot before and after is byte-identical (
cmpon two 1440×900 PNGs).Part of a set of three a11y PRs; the other two fix
button-nameandcolor-contrast.