Skip to content

Conversation

oliveror
Copy link
Member

Changes

  • "Skip to main content" is now the first tab stop on every page (AppShell). It is off-screen until it receives keyboard focus, then appears top left in white on the dark text colour (#0f172a, contrast ≈ 17:1), independent of the brand colour.
  • <main> has id="main-content" and tabIndex={-1}, so activating the link moves keyboard focus into the content (the next Tab continues inside main). The link focuses main directly instead of adding #main-content to the URL; the href remains as a fallback.
  • main:focus has no outline, as it is a container focused only programmatically.

Validation

  • npm run check passes (211 unit tests).
  • New browser test: first Tab focuses the visible skip link (colours asserted), Enter focuses main without changing the URL, next Tab stays inside main. Other smoke tests pass (except the two macOS select tests fixed in test(e2e): make keyboard select tests pass on macOS #88).

Notes

AI usage

Written with Claude Code (Anthropic) to address a teammate's review of the final-delivery findings. Please review the diff as you would any other contribution.

Closes #102

Keyboard users had to tab through the whole header on every page. A
"Skip to main content" link is now the first tab stop: hidden until
focused, then shown top left in white on the dark text colour. It moves
focus to <main id="main-content" tabIndex={-1}> without adding a hash
to the URL. Browser test covers focus order, visibility, colours and the
focus move.

Closes #102
Copy link
Member

@olestan olestan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes due to a keyboard accessibility regression:

  • AppShell.tsx:20: Focusing <main> can scroll it behind the sticky header (~5rem) on long pages, hiding the first interactive element (e.g., the Back button on recipe detail pages).
  • Suggested fix: Add scroll-margin-top to <main> to account for the sticky header, and extend the E2E test to verify that the next focused element remains visible after activating the skip link.

Focusing <main> on a scrolled-down page scrolled it behind the sticky
header, hiding its first control (e.g. Back on recipe detail). main now has
scroll-margin-top of the header height (new --site-header-height token,
also used by the header). E2E: on a long, scrolled recipe page, skip link
then Tab focuses Back fully in view and below the header.
@oliveror
Copy link
Member Author

Thanks, confirmed and fixed in the latest commit:

  • scroll-margin-top on <main>: set to the header height plus a small gap. I added a --site-header-height token (5rem) and use it in SiteHeader.css as well, so the two can't drift apart.
  • E2E extended: a new test opens a long recipe at 1280×700, scrolls well down, then does Tab → skip link → Enter → Tab. It checks that Back is focused, fully in the viewport, and starts below the header's bottom edge. On the previous commit it fails: Back is at y=15, under the header that ends at y=81.

npm run check (211 unit tests) passes, and both skip-link e2e tests pass. In the full smoke run, the two keyboard-<select> tests fail on macOS because this branch predates the macOS fix on dev (ab0b2b3); they're unrelated to this change and should pass after a rebase.

Heads-up: #113 and #116 also touch focus and scroll handling, so whichever of the three merges last may need a small rebase.

# Conflicts:
#	apps/web/src/components/shell/AppShell/AppShell.tsx
@oliveror oliveror merged commit dcf561f into dev Nov 17, 2026
2 checks passed
@oliveror oliveror mentioned this pull request Nov 17, 2026
3 tasks
@oliveror oliveror deleted the feature/a11y-skip-link branch November 21, 2026 14:18
Sign in to join this conversation on GitHub.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants