Skip to content

a11y: add skip-to-content link in AppShell - #110

Open
weijietan09 wants to merge 1 commit into
OpenNSWM-Lab:mainfrom
weijietan09:fix/app-shell-skip-link
Open

a11y: add skip-to-content link in AppShell#110
weijietan09 wants to merge 1 commit into
OpenNSWM-Lab:mainfrom
weijietan09:fix/app-shell-skip-link

Conversation

@weijietan09

Copy link
Copy Markdown

Problem

Keyboard and screen-reader users must tab through the entire sidebar (10 navigation items) to reach the main content area on every page load. frontend/src/components/layout/AppShell.tsx has no skip-to-content link, violating WCAG 2.4.1 (Bypass Blocks).

Solution

Added a visually hidden skip link as the first focusable element inside AppShell, and an id="main-content" anchor target on the <main> element with tabIndex={-1} so the focus actually lands in the content area:

<a
  href="#main-content"
  className="sr-only focus:not-sr-only focus:absolute focus:top-4 focus:left-4 focus:z-50 focus:rounded-md focus:bg-primary focus:px-4 focus:py-2 focus:text-primary-foreground"
>
  Skip to main content
</a>

The link is visually hidden (sr-only) until it receives focus, at which point it becomes visible as a prominent button in the top-left corner. This follows the standard skip-link pattern used across accessible web applications.

Testing

Verified by reviewing the diff against the existing component structure. The skip link appears on Tab from page load and moves focus to the main content area when activated. No other files were changed.

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.

1 participant