Skip to content

Add skip to main content navigation link for accessibility - #8770

Open
vanibhardwaj05 wants to merge 1 commit into
reactjs:mainfrom
vanibhardwaj05:fix/skip-to-main-content
Open

vanibhardwaj05 wants to merge 1 commit into
reactjs:mainfrom
vanibhardwaj05:fix/skip-to-main-content

Conversation

@vanibhardwaj05

Copy link
Copy Markdown

Summary

Fixes #8360 (Part 1: Skip Navigation)

Problem Description

Currently, react.dev lacks a "Skip to main content" bypass link (violating WCAG 2.4.1 Level A). Keyboard-only and screen-reader users must navigate through all elements in TopNav and SidebarNav on every single page load before reaching primary content.

Solution

  • Added a standard visually-hidden skip link (<a href="#main-content">Skip to main content</a>) positioned as the first focusable element on every page in src/components/Layout/Page.tsx.
  • Added id="main-content" to the primary <main> landmark element.
  • Utilized Tailwind's sr-only and focus:not-sr-only utilities with theme brand colors to display cleanly when focused via Tab.

Verification

  • Tested with keyboard navigation: tabbing on page load immediately reveals the Skip to main content button, and pressing Enter jumps focus directly to the <main id="main-content"> container.
  • Confirmed zero visual change for non-keyboard users.

@github-actions

Copy link
Copy Markdown

Size changes

Details

📦 Next.js Bundle Analysis for react-dev

This analysis was generated by the Next.js Bundle Analysis action. 🤖

⚠️ Global Bundle Size Increased

Page Size (compressed)
global 115.32 KB (🟡 +174 B)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

Five Pages Changed Size

The following pages changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load
/404 127.71 KB (🟡 +97 B) 243.03 KB
/500 127.72 KB (🟡 +97 B) 243.04 KB
/[[...markdownPath]] 130.2 KB (🟡 +97 B) 245.52 KB
/errors 127.96 KB (🟡 +97 B) 243.28 KB
/errors/[errorCode] 127.94 KB (🟡 +97 B) 243.25 KB
Details

Only the gzipped size is provided here based on an expert tip.

First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

Next to the size is how much the size has increased or decreased compared with the base branch of this PR. If this percentage has increased by 10% or more, there will be a red status indicator applied, indicating that special attention should be given to this.

This branch was successfully deployed

1 active deployment
Preview — 5d8ffd2c Deployed Nov 21, 2026 by vercel[bot]
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.

Accessibility improvements: heading hierarchy, skip navigation, link text

1 participant