🎨 Palette: Add skip-to-content link for keyboard accessibility (#169)
💡 What: Added a "Skip to content" link that is visually hidden by default but appears when focused via keyboard. Pointed it to the main content area using `id="main-content"` and `tabIndex={-1}`. 🎯 Why: Keyboard users and screen readers must otherwise tab through the entire navigation menu on every page load before reaching the actual page content. This is tedious and a poor UX. 📸 Before/After: Before, keyboard focus started on "Home" in the header. After, the first tab press shows the "Skip to content" link at the top left of the screen. ♿ Accessibility: Massively improves WCAG compliance (Bypass Blocks) and keyboard navigation efficiency. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: ralksta <ralksta@users.noreply.github.com>
This commit is contained in:
@@ -90,6 +90,9 @@ export default function RootLayout({ children }: { children: React.ReactNode })
|
||||
<link rel="stylesheet" href={fontsUrl} />
|
||||
</head>
|
||||
<body>
|
||||
<a href="#main-content" className="skip-link">
|
||||
Skip to content
|
||||
</a>
|
||||
<header className="header">
|
||||
<nav className="header__nav">
|
||||
<Link href="/" className="header__nav-link">
|
||||
@@ -107,7 +110,9 @@ export default function RootLayout({ children }: { children: React.ReactNode })
|
||||
<ThemeToggle />
|
||||
</nav>
|
||||
</header>
|
||||
<main className="main">{children}</main>
|
||||
<main id="main-content" tabIndex={-1} className="main">
|
||||
{children}
|
||||
</main>
|
||||
<Footer />
|
||||
<ScrollToTop />
|
||||
{process.env.NODE_ENV === 'development' && <DevToolbarLoader />}
|
||||
|
||||
Reference in New Issue
Block a user