Skip to content

fix(a11y-menu): add scroll margin to skip link target on homepage#1689

Open
knowler wants to merge 2 commits into
mdn:mainfrom
knowler:patch-1
Open

fix(a11y-menu): add scroll margin to skip link target on homepage#1689
knowler wants to merge 2 commits into
mdn:mainfrom
knowler:patch-1

Conversation

@knowler

@knowler knowler commented Jul 3, 2026

Copy link
Copy Markdown

Description

This adds some scroll margin to the “Skip to main content” target on the homepage (i.e. #content), so that the target’s content does not scroll beneath the sticky header.

Motivation

Relevant visible content is obscured when following the skip link and what’s visible is still important for keyboard users and even screen reader users.

Before video

Description: in Firefox a user navigates to the MDN homepage and tabs to the “Skip to main content” link, upon activation the hero content scrolls beneath the sticky header causing some of the target content to be obscured.

skip-link-before.mp4
After video

Description: in Firefox a user navigates to the MDN homepage and tabs to the “Skip to main content” link, upon activation the page scrolls slightly so that the ad is out of view, but the target content is not obscured at all.

skip-link-after.mp4

Additional details

As far as I can tell, this isn’t a problem on other pages.

Related issues and pull requests

Looked, but couldn’t find any.

@knowler knowler requested a review from a team as a code owner July 3, 2026 15:24
@knowler knowler requested a review from caugner July 3, 2026 15:24
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

2ac6c69 was deployed to: https://fred-pr1689.review.mdn.allizom.net/

@knowler

knowler commented Jul 6, 2026

Copy link
Copy Markdown
Author

Some other affected routes:

  • /search
  • /about
  • /advertising
  • /community
  • /blog
    • Also individual blog posts.
  • /play
  • /observatory

There’s probably a better way to handle all of these rather than individual changes like this one.

@caugner caugner changed the title Add scroll margin to skip link target on homepage fix(a11y-menu): add scroll margin to skip link target on homepage Jul 6, 2026
.homepage {
display: grid;
grid-template-columns: var(--layout-no-sidebar-extended);
scroll-margin-block-start: var(--sticky-header-height);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You could add this inside #content { … } directly to components/global/global.css instead, assuming it has no negative side-effects on content pages.

@caugner caugner added the claude-review Re-request a Claude review label Jul 6, 2026
@github-actions github-actions Bot removed the claude-review Re-request a Claude review label Jul 6, 2026
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.

3 participants