Skip to content

a11y(baseof): add skip-to-content link and a <main> landmark#3336

Open
Vidminas wants to merge 1 commit into
HugoBlox:mainfrom
Vidminas:a11y/skip-link-main-landmark
Open

a11y(baseof): add skip-to-content link and a <main> landmark#3336
Vidminas wants to merge 1 commit into
HugoBlox:mainfrom
Vidminas:a11y/skip-link-main-landmark

Conversation

@Vidminas

Copy link
Copy Markdown

Keyboard and screen-reader users had no way to bypass the repeated header nav, and the content region was a bare <div class="page-body"> with no landmark (WCAG 2.4.1).

πŸš€ What type of change is this?

  • πŸ› Bug fix (A non-breaking change that fixes an issue)
  • ✨ New feature (A non-breaking change that adds functionality)
  • πŸ’… Style change (A change that only affects formatting, visuals, or styling)
  • πŸ“š Documentation update (Changes to documentation only)
  • 🧹 Refactor or chore (A code change that neither fixes a bug nor adds a feature)
  • πŸ’₯ Breaking change (A fix or feature that would cause existing functionality to not work as expected)

🎯 What is the purpose of this change?

Two related accessibility gaps in baseof.html (WCAG 2.4.1 β€” Bypass Blocks):

  1. No skip link β€” keyboard/AT users must tab through the entire header nav on every page to
    reach the content.
  2. No <main> landmark β€” the content region is a bare <div class="page-body">, so screen
    readers can't jump to "main".

Fix.

  • Add a skip link as the first focusable element in <body>, visually hidden until focused
    (sr-only β†’ focus:not-sr-only + a visible focused state), targeting #main-content.
  • Promote the page-body wrapper from <div> to <main id="main-content"> (keeps the page-body
    class, so styling is unchanged).
  • Add a skip_to_main_content string to i18n/en.yaml; other locales fall back to English until
    translated.

Verified on the academic-cv starter: the skip link is the first focusable element (before the
header in source order), <main id="main-content"> wraps the content, and the sr-only utilities
compile. Tabbing from the top reveals the skip link, which jumps focus to the content.


πŸ“Έ Screenshots or Screencast (if applicable)

Pressing Tab from the top of the page (academic-cv starter):

Before β€” main After β€” this PR
c1-before c1-after

Before, the first tab stop is the site logo β€” a keyboard/screen-reader user must then tab through
the entire nav to reach the content. After, the first tab stop is a "Skip to main content"
button that jumps straight to <main>.


ℹ️ Documentation Check

  • No, this change does not require a documentation update.
  • Yes, I have updated the documentation accordingly (or will in a follow-up PR).

Nothing to configure β€” the skip link and <main> landmark are automatic (no block/param/API), so there's no in-repo doc to change, and this repo has no accessibility/features page (user docs live on docs.hugoblox.com). Two follow-ups belong there, not in this PR:


πŸ“œ Contributor Agreement

Thank you for your contribution!

Keyboard and screen-reader users had no way to bypass the repeated header nav,
and the content region was a bare `<div class="page-body">` with no landmark
(WCAG 2.4.1).

- Add a skip link as the first focusable element, visually hidden until focused
  (sr-only / focus:not-sr-only), targeting `#main-content`.
- Promote the page-body wrapper from `<div>` to `<main id="main-content">`.
- Add the `skip_to_main_content` string to i18n/en.yaml (other locales fall
  back to English until translated).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Vidminas Vidminas requested a review from gcushen as a code owner July 11, 2026 07:42
@netlify

netlify Bot commented Jul 11, 2026

Copy link
Copy Markdown

βœ… Deploy Preview for academic-demo canceled.

Name Link
πŸ”¨ Latest commit c3606ed
πŸ” Latest deploy log https://app.netlify.com/projects/academic-demo/deploys/6a51f3fd278c480008396ecd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant