Skip to content

Commit 013a48d

Browse files
rahulchhabriamacuzi
authored andcommitted
feat(a11y): Add skip-to-content accessibility link (#17527)
## 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>
1 parent a8aa7d2 commit 013a48d

5 files changed

Lines changed: 427 additions & 368 deletions

File tree

app/globals.css

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,28 @@
44
@tailwind components;
55
@tailwind utilities;
66

7+
.skip-to-content {
8+
position: fixed;
9+
top: 0.75rem;
10+
left: 0.75rem;
11+
z-index: 9999;
12+
padding: 0.5rem 1rem;
13+
border-radius: 0.5rem;
14+
background-color: var(--accent-purple);
15+
color: #fff;
16+
font-weight: 500;
17+
text-decoration: none;
18+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
19+
transform: translateY(-200%);
20+
transition: transform 0.15s ease-in-out;
21+
}
22+
23+
.skip-to-content:focus {
24+
transform: translateY(0);
25+
outline: 2px solid var(--accent-purple);
26+
outline-offset: 2px;
27+
}
28+
729
.radix-themes {
830
--cursor-button: pointer;
931
--iris-9: var(--accent);

app/layout.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type {Metadata} from 'next';
55
import {Rubik} from 'next/font/google';
66
import Script from 'next/script';
77
import PlausibleProvider from 'next-plausible';
8+
import {SkipToContent} from 'sentry-docs/components/skipToContent';
89
import {ThemeProvider} from 'sentry-docs/components/theme-provider';
910

1011
const rubik = Rubik({
@@ -43,6 +44,7 @@ export default function RootLayout({children}: {children: React.ReactNode}) {
4344
disableTransitionOnChange
4445
>
4546
<Theme accentColor="iris" grayColor="sand" radius="large" scaling="95%">
47+
<SkipToContent />
4648
{children}
4749
</Theme>
4850
</ThemeProvider>

app/not-found.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export default function NotFound() {
4545
) : (
4646
<Header pathname="/" searchPlatforms={[]} noSearch platforms={[]} />
4747
)}
48-
<main className="px-8 pt-28">
48+
<main id="main" className="px-8 pt-28">
4949
<h1 className="font-medium text-3xl mb-4">Page Not Found</h1>
5050
<p className="text-lg">We couldn't find the page you were looking for :(</p>
5151

0 commit comments

Comments
 (0)