🎨 Palette: Add Skip to Content link #52
Reference in New Issue
Block a user
Delete Branch "palette-skip-link-9599669443406755825"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Implemented a "Skip to Content" link that allows keyboard users to bypass the navigation menu.
src/components/ui/SkipLink.tsxand CSS module.src/App.tsxto include the link.Home,About,Contactpages to have a targetablemainelement.pnpm exec vitest) and manual verification with Playwright script (screenshot confirmed visibility on focus).PR created automatically by Jules for task 9599669443406755825 started by @ragusa-it
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.
When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.
I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!
For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with
@jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!New to Jules? Learn more at jules.google/docs.
For security, I will only act on instructions from the user who triggered this task.
Pull request overview
This PR implements a "Skip to Content" link to improve keyboard navigation accessibility in compliance with WCAG 2.1 2.4.1. The implementation adds a visually hidden link that appears on focus, allowing keyboard users to bypass navigation and jump directly to main content.
Changes:
id="main-content",tabIndex={-1}, and inline outline removalReviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 6 comments.
Show a summary per file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
@@ -0,0 +1,21 @@.skipLink {position: absolute;Consider using
position: fixedinstead ofposition: absolute. While both work in this case,fixedis more semantically correct for a skip link that should always be positioned relative to the viewport, and it makes the positioning behavior more explicit and predictable regardless of parent element positioning.@@ -0,0 +5,4 @@const { t } = useTranslation();return (<a href="#main-content" className={styles.skipLink}>The skip link may not consistently focus the main content across all browsers. Consider adding an onClick handler that prevents default behavior, scrolls to the element, and programmatically calls
.focus()on it. For example:onClick={(e) => { e.preventDefault(); document.getElementById('main-content')?.focus(); }}. This ensures consistent behavior across browsers and properly announces the focus change to screen readers.@@ -0,0 +33,4 @@// However, usually vite-plugin handles this.// Let's just check if it renders.expect(link).toBeTruthy();});The verbose comment about CSS modules testing can be simplified or removed. The test correctly verifies that the component renders. If concerns about CSS module class names remain, consider either removing this test (since it only checks rendering which is already covered by the first test), or simplifying the comment to a brief note about CSS module handling.
@@ -50,0 +52,4 @@id="main-content"tabIndex={-1}style={{ outline: 'none' }}>The inline style removing the outline could create an accessibility issue. When the skip link focuses this element, keyboard users won't see any visual indicator that focus has moved to the main content. Consider either removing the inline style to allow the default focus indicator from global.css (
:focus-visible { outline: 2px solid var(--md-sys-color-primary); }), or adding a custom focus style that provides a visible indicator while preventing unwanted outlines during normal navigation. A better approach would be to use:focus:not(:focus-visible)in CSS to handle this case.@@ -137,0 +138,4 @@id="main-content"tabIndex={-1}style={{ outline: 'none' }}>The inline style removing the outline could create an accessibility issue. When the skip link focuses this element, keyboard users won't see any visual indicator that focus has moved to the main content. Consider either removing the inline style to allow the default focus indicator from global.css (
:focus-visible { outline: 2px solid var(--md-sys-color-primary); }), or adding a custom focus style that provides a visible indicator while preventing unwanted outlines during normal navigation. A better approach would be to use:focus:not(:focus-visible)in CSS to handle this case.@@ -4,3 +4,3 @@return (<main><main id="main-content" tabIndex={-1} style={{ outline: 'none' }}><Hero />The inline style removing the outline could create an accessibility issue. When the skip link focuses this element, keyboard users won't see any visual indicator that focus has moved to the main content. Consider either removing the inline style to allow the default focus indicator from global.css (
:focus-visible { outline: 2px solid var(--md-sys-color-primary); }), or adding a custom focus style that provides a visible indicator while preventing unwanted outlines during normal navigation. A better approach would be to use:focus:not(:focus-visible)in CSS to handle this case.Pull request closed