642c5b7322
Add the a11y foundation and bring login, lobby, and the in-game shell to WCAG 2.2 AA: - Primitives: .sr-only + .skip-link (base.css), trapFocus (modal focus trap + restore) and restoreFocus (menu focus restore) actions, the --color-focus visible ring. - In-game shell: skip link + focusable main landmark; WAI-ARIA sidebar tabs (roving tabindex, arrow/Home/End, tabpanel wiring); menu Escape + focus restore (account / view / turn-navigator / map-toggles / bottom-tabs); mail compose as a role=dialog modal with a focus trap. - login / lobby / lobby-create: skip link + main landmark, field labels, role=alert / role=status live regions. - Map canvas: aria-label naming it a visual overview, with its data reachable by keyboard via the sidebar inspector and tables (accessible alternative; in-canvas keyboard nav deferred). Gates (chromium-desktop): tests/e2e/a11y-axe.spec.ts scans every top-level view for WCAG 2.2 AA violations (zero); a11y-keyboard.spec.ts covers the skip link, menu Escape+restore, and tab roving. Adds @axe-core/playwright. Docs: ui/docs/a11y.md (+ index). Marks F1 and F2 done in ui/PLAN-finalize.md. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
68 lines
1.7 KiB
CSS
68 lines
1.7 KiB
CSS
/*
|
|
* Global element baseline, layered on top of the design tokens. Kept
|
|
* deliberately small: it sets the document background, default text
|
|
* colour/typography, a token-driven focus ring, and selection colour.
|
|
* Component-scoped styles still own everything else.
|
|
*
|
|
* The focus-ring rule uses :where() so its specificity is zero and any
|
|
* component that defines its own focus treatment wins without !important.
|
|
*/
|
|
|
|
body {
|
|
margin: 0;
|
|
background: var(--color-bg);
|
|
color: var(--color-text);
|
|
font-family: var(--font-sans);
|
|
font-size: var(--text-base);
|
|
line-height: var(--leading-normal);
|
|
-webkit-font-smoothing: antialiased;
|
|
-moz-osx-font-smoothing: grayscale;
|
|
}
|
|
|
|
:where(*):focus-visible {
|
|
outline: 2px solid var(--color-focus);
|
|
outline-offset: 2px;
|
|
}
|
|
|
|
::selection {
|
|
background: var(--color-accent-subtle);
|
|
}
|
|
|
|
/*
|
|
* Visually-hidden content that stays available to assistive tech. Use
|
|
* for labels/announcements a sighted user gets from layout or icons.
|
|
*/
|
|
.sr-only {
|
|
position: absolute;
|
|
width: 1px;
|
|
height: 1px;
|
|
padding: 0;
|
|
margin: -1px;
|
|
overflow: hidden;
|
|
clip: rect(0, 0, 0, 0);
|
|
white-space: nowrap;
|
|
border: 0;
|
|
}
|
|
|
|
/*
|
|
* Skip link: visually hidden until focused, then slides into the
|
|
* top-left so a keyboard user can jump straight to the main content.
|
|
* Each layout renders one as its first focusable element, targeting a
|
|
* `tabindex="-1"` main region.
|
|
*/
|
|
.skip-link {
|
|
position: absolute;
|
|
left: var(--space-2);
|
|
top: -4rem;
|
|
z-index: 100;
|
|
padding: var(--space-2) var(--space-3);
|
|
background: var(--color-surface-overlay);
|
|
color: var(--color-text);
|
|
border: 1px solid var(--color-border);
|
|
border-radius: var(--radius-sm);
|
|
transition: top 120ms ease;
|
|
}
|
|
.skip-link:focus-visible {
|
|
top: var(--space-2);
|
|
}
|