Skip to content

fix: add header and main landmarks for accessibility - #193

Merged
magnus-madsen merged 1 commit into
masterfrom
a11y-landmarks
Aug 3, 2026
Merged

fix: add header and main landmarks for accessibility#193
magnus-madsen merged 1 commit into
masterfrom
a11y-landmarks

Conversation

@magnus-madsen

Copy link
Copy Markdown
Member

PageSpeed flags the site for missing HTML5 landmarks. The layout had no main landmark at all, and the "Fork me on GitHub" ribbon link sat outside every landmark region.

Changes in src/layouts/Layout.astro (so they apply to all 10 pages):

  • Wrap <slot /> in <main>.
  • Group the ribbon link and the navbar under <header>.
  • Label the existing <nav> with aria-label="Main".

No visual change: the ribbon <img> is position: absolute against the viewport (it has no positioned ancestor), so moving it in the DOM only affects reading order, and Bootstrap 4's reboot already sets header, nav, and main to display: block, so the navbar's .menu negative margins behave as before.

Verified with npm run build: all 10 built pages contain the new landmarks.

Not included: a skip-to-content link. It is the usual companion fix, but it adds a visible-on-focus element, so I left it out.

🤖 Generated with Claude Code

PageSpeed flags the site for missing HTML5 landmarks. The layout had no
main landmark, and the "Fork me on GitHub" ribbon sat outside every
landmark region.

Wrap the slot in <main>, group the ribbon and navbar under <header>, and
name the existing <nav>. No visual change: the ribbon is positioned
against the viewport, so its place in the DOM only affects reading order,
and Bootstrap's reboot already gives header/nav/main display: block.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@magnus-madsen
magnus-madsen merged commit a89ef05 into master Aug 3, 2026
2 checks passed
@magnus-madsen
magnus-madsen deleted the a11y-landmarks branch August 3, 2026 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant