This repository has been archived on 2026-11-23. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
hope-events/frontend/src/components/layout/SkipLink.tsx
T
joshuaandClaude Opus 5.5 e9d1b1fb24 Accessibility pass, WCAG 2.2 AA (1.50.0)
Public pages, auth, registration, payment, My Events and the kiosk: skip
link, focus ring, labels tied to fields, named quantity buttons, announced
errors, ModalOverlay popups (focus trap, Escape, focus return), contrast
and underlined in-text links, reduced motion. Branding warns about a primary
colour too light for white text and offers a darker shade. axe-core and
keyboard checks in e2e/accessibility.spec.ts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 15:41:19 +02:00

28 lines
890 B
TypeScript

"use client";
/**
* "Skip to main content" — the first thing a keyboard user reaches on every page. Hidden
* until focused. Pages put their content in a <main> of their own, so the link finds it
* when used rather than relying on a fixed id.
*/
export function SkipLink() {
const skip = (e: React.MouseEvent<HTMLAnchorElement>) => {
const main = document.querySelector("main");
if (!main) return;
e.preventDefault();
if (!main.hasAttribute("tabindex")) main.setAttribute("tabindex", "-1");
main.focus();
main.scrollIntoView();
};
return (
<a
href="#main"
onClick={skip}
className="sr-only focus:not-sr-only focus:fixed focus:top-2 focus:left-2 focus:z-[100] focus:rounded-md focus:bg-white focus:px-4 focus:py-2 focus:text-sm focus:font-medium focus:text-gray-900 focus:shadow-lg"
>
Skip to main content
</a>
);
}