Skip to content

Docs: add a <main> landmark to the homepage and the 404 page - #43105

Merged
julien-deramond merged 1 commit into
mainfrom
v6-jd-docs-main-landmark
Oct 16, 2026
Merged

julien-deramond merged 1 commit into
mainfrom
v6-jd-docs-main-landmark

Conversation

@julien-deramond

@julien-deramond julien-deramond commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

The homepage and the 404 page have no <main> landmark. axe's landmark-one-main rule fails on both, and the "Skip to main content" link lands on a plain div on the homepage and on nothing at all on the 404 page.

Every other page gets its <main> from its layout through the main slot. @twbs/bui's BaseLayout is supposed to wrap pages that don't fill that slot in <main id="content">, but our BaseLayout always fills it, so that fallback never runs and the page content is rendered bare. Now our BaseLayout renders <main id="content"> itself in that case, with the page's overrides.main attributes. The masthead drops its own id="content", and the 404 page drops the id: 'content' it passed, since the layout sets it.

Closes #43045.

The homepage doesn't change: the screenshots before and after are identical at 1280px and 390px. The 404 page does, because its overrides.main (my-auto p-5) was never applied while no <main> was rendered. With d-flex flex-column min-vh-100 on the body, the message is now centered vertically and the footer sits at the bottom, as the page's markup intended.

Before After
before: the 404 page at 1280px, the message sits right under the navbar and the footer follows it after: the 404 page at 1280px, the message is centered vertically and the footer sits at the bottom of the window
before: the 404 page at 390px after: the 404 page at 390px, with more padding around the message, the footer still fills the rest of the screen

I fixed the layout instead of turning the masthead into <main> (as #43102 does), because that only fixes the homepage and leaves the 404 page without a landmark. In the fallback, id: 'content' comes before the spread of mainProps, so a page that passes its own id replaces it instead of printing a second id attribute.

In the built site, every page rendered by BaseLayout now has exactly one <main>. The few pages still without one are the standalone snippet examples, which have their own markup. I didn't run axe, Lighthouse, or a screen reader.

Live previews

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@julien-deramond julien-deramond added docs Documentation site and its content accessibility Keyboard, screen readers, contrast, ARIA v6 v6, the main branch bug Something does not work as documented labels Oct 16, 2026
@julien-deramond
julien-deramond marked this pull request as ready for review October 16, 2026 17:05
@github-project-automation github-project-automation Bot moved this to Inbox in v6.0.0 Oct 16, 2026
@julien-deramond
julien-deramond merged commit 54f2d26 into main Oct 16, 2026
13 checks passed
@julien-deramond
julien-deramond deleted the v6-jd-docs-main-landmark branch October 16, 2026 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

accessibility Keyboard, screen readers, contrast, ARIA bug Something does not work as documented docs Documentation site and its content v6 v6, the main branch

Projects

Status: Inbox

Development

Successfully merging this pull request may close these issues.

v6 homepage: accessibility improvement

1 participant