Archived
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>
28 lines
890 B
TypeScript
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>
|
|
);
|
|
}
|