Skip to content

feat(a11y): add skip-to-content accessibility link#17479

Open
macuzi wants to merge 3 commits intogetsentry:masterfrom
macuzi:macuzi/feat/skip-to-content
Open

feat(a11y): add skip-to-content accessibility link#17479
macuzi wants to merge 3 commits intogetsentry:masterfrom
macuzi:macuzi/feat/skip-to-content

Conversation

@macuzi
Copy link
Copy Markdown
Contributor

@macuzi macuzi commented Apr 25, 2026

Add a keyboard-accessible “Skip to content” link that only appears on Tab focus, jumps directly to the main content area, and resets focus on client-side route changes so it remains the first Tab stop after navigation.

  • New SkipToContent client component in src/components/skipToContent.tsx
  • Added to root layout as first focusable element
  • CSS in globals.css: hidden by default, slides in on keyboard focus
  • Resets focus to document body on client-side navigation via usePathname
CleanShot.2026-04-25.at.12.24.40.mp4
  • Not urgent, can wait up to 1 week+

Add a keyboard-accessible "Skip to content" link that appears on Tab
focus and jumps to the main content area. Resets focus navigation on
client-side route changes so the link remains the first Tab stop.
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 25, 2026

@macuzi is attempting to deploy a commit to the Sentry Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit bf56b37. Configure here.

Comment thread src/components/skipToContent.tsx Outdated
Comment thread src/components/skipToContent.tsx Outdated
Comment thread src/components/skipToContent.tsx Outdated
Comment on lines +28 to +30
<a ref={ref} href="#main" className="skip-to-content">
Skip to content
</a>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: The skip-to-content link is broken on pages that don't include the DocPage component because the target element with id="main" is missing.
Severity: MEDIUM

Suggested Fix

Ensure that a main content element with id="main" is present on all pages where the SkipToContent component is rendered. This can be achieved by adding the id="main" attribute to the primary content container of pages like the home page, API category pages, and API endpoint pages.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: src/components/skipToContent.tsx#L28-L30

Potential issue: The `SkipToContent` component is rendered on all pages via the root
layout and includes a link with `href="#main"`. However, the target element with
`id="main"` is only present in the `DocPage` component. On pages that do not render
`DocPage`, such as the home page, API category pages, and API endpoint pages, the
skip-to-content link is non-functional. This fails to provide the intended accessibility
feature for keyboard users on those pages.

Did we get this right? 👍 / 👎 to inform future reviews.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The #main anchor exists on most pages (including all doc pages). On a few edge cases like the home page, the skip link will currently have no effect, but we can expand support to additional layouts in a follow-up if needed.

Add matching #main targets to the home and 404 pages so the root skip link works outside DocPage-rendered routes. Remove the unused skip-link anchor ref.
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 28, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
develop-docs Ready Ready Preview, Comment Apr 29, 2026 4:29am
sentry-docs Ready Ready Preview, Comment Apr 29, 2026 4:29am

Request Review

Merge origin/master into the skip-to-content branch. Keep the incoming home page card updates while preserving the #main target needed by the skip link.
rahulchhabria added a commit that referenced this pull request Apr 29, 2026
## DESCRIBE YOUR PR
Adds a root-level skip-to-content link and ensures non-DocPage routes
have a matching `#main` target. This keeps keyboard users from getting
stuck on the home page or 404 page when using the skip link.

This replaces fork PR #17479 so the Codeowner assignment workflow can
run with same-repo permissions.

## IS YOUR CHANGE URGENT?  

- [ ] Urgent deadline (GA date, etc.):
- [ ] Other deadline:
- [x] None: Not urgent, can wait up to 1 week+

## SLA

- Teamwork makes the dream work, so please add a reviewer to your PRs.
- Please give the docs team up to 1 week to review your PR unless you
have added an urgent due date to it.
Thanks in advance for your help!

## PRE-MERGE CHECKLIST

- [ ] Checked Vercel preview for correctness, including links
- [x] PR was reviewed and approved by any necessary SMEs (subject matter
experts)
- [ ] PR was reviewed and approved by a member of the [Sentry docs
team](https://github.com/orgs/getsentry/teams/docs)

---------

Co-authored-by: macuzi <lamberto.asghedom@sentry.io>
cameroncooke pushed a commit that referenced this pull request Apr 30, 2026
## DESCRIBE YOUR PR
Adds a root-level skip-to-content link and ensures non-DocPage routes
have a matching `#main` target. This keeps keyboard users from getting
stuck on the home page or 404 page when using the skip link.

This replaces fork PR #17479 so the Codeowner assignment workflow can
run with same-repo permissions.

## IS YOUR CHANGE URGENT?  

- [ ] Urgent deadline (GA date, etc.):
- [ ] Other deadline:
- [x] None: Not urgent, can wait up to 1 week+

## SLA

- Teamwork makes the dream work, so please add a reviewer to your PRs.
- Please give the docs team up to 1 week to review your PR unless you
have added an urgent due date to it.
Thanks in advance for your help!

## PRE-MERGE CHECKLIST

- [ ] Checked Vercel preview for correctness, including links
- [x] PR was reviewed and approved by any necessary SMEs (subject matter
experts)
- [ ] PR was reviewed and approved by a member of the [Sentry docs
team](https://github.com/orgs/getsentry/teams/docs)

---------

Co-authored-by: macuzi <lamberto.asghedom@sentry.io>
@coolguyzone
Copy link
Copy Markdown
Contributor

@macuzi I noticed that when you 'skip to content' you skip past the title and description, is that by design?

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