feat(a11y): WCAG-compliant focus contrast, 44px targets, reduced motion - #1451
Open
Sundriveauto wants to merge 1 commit into
Open
feat(a11y): WCAG-compliant focus contrast, 44px targets, reduced motion#1451Sundriveauto wants to merge 1 commit into
Sundriveauto wants to merge 1 commit into
Conversation
Recreate :focus-visible outlines with >= 3:1 non-text contrast against every background token by adding a mode-aware --ring-strong token: the previous gold ring only reached ~2:1 on light surfaces. Enforce a 44x44 minimum interactive target for buttons/links/form controls (WCAG 2.5.5) in place of the partial min-height-only rule, and strengthen the prefers-reduced-motion block so spinners, skeleton shimmer, and toast transitions are disabled. Expand the accessibility.css test suite to guard all three behaviours per scheme, and fix the test:a11y script's now-unsupported Jest flag (--testPathPattern -> --testPathPatterns) so accessibility.yml CI runs the suite. Generated with Codebuff 🤖 Co-Authored-By: Codebuff <noreply@codebuff.com>
|
@Sundriveauto Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1320
Closes #1321
Closes #1322
Closes #1323
Summary
Closes the WCAG 2.1 AA compliance requirement behind the frontend's "WCAG 2.1 AA" tagline and its dedicated accessibility style suite. Three gaps are closed so the existing
accessibility.ymlCI workflow truly enforces the standard::focus-visibleoutlines now meet non-text-contrast (≥ 3:1) against every background token in both color schemes.prefers-reduced-motiondisables non-essential animation (spinners, skeleton shimmer, toast transitions).Problem
var(--ring)(gold#f59e0b). On light background tokens it only reached ~1.9–2.2:1 — below the 3:1 WCAG non-text-contrast threshold. Gold is fine on dark surfaces but fails on light ones.min-height: 44pxonbutton/a[role='menuitem']/checkbox/radio/select — plain links and full 44 × 44 targets were not enforced.prefers-reduced-motioncoverage of spinners/shimmer/toasts wasn't backed by tests.Changes
Focus indicator contrast (
tokens.css,accessibility.css)--ring-strongtoken:#fbbf24(verified 9.5–11.8:1 on all dark bg tokens)#1e3a8a(verified 9.2–10.4:1 on all light bg tokens)*:focus-visibleand.skip-link:focusnow usevar(--ring-strong, var(--ring, #f59e0b))(graceful fallback).Interactive target size (
accessibility.css)button,[role='button'],a[href],input,select,textarea,summaryatmin-width: 44px; min-height: 44px.Reduced motion (
accessibility.css)animation/transitionunderprefers-reduced-motion: reduce, plus an explicitanimation: nonefor.spinner,.loading-spinner .spinner, and.skeleton(shimmer). Toast transitions are covered by the universaltransition-duration: 0.01ms.Test suite (
accessibility.css.test.ts).visually-hiddenuniqueness check to 9 tests guarding all three requirements:--ring-strongagainst every background token (including composited--surface-glass)@media (prefers-reduced-motion: reduce)query and spinner/shimmer/toast disablementTooling (
package.json)test:a11yfrom Jest-30-unsupported--testPathPattern→--testPathPatternsso theaccessibility.ymljest-axe-testsjob actually runs the suite (it was a no-op/broken flag).Verification
cd frontend && npx jest src/styles/__tests__/accessibility.css.test.ts→ 9/9 passingTesting checklist
accessibility.css.test.tspasses (9/9)test:a11yscript executes the suite under Jest 30 (was broken before)LandingPage.accessibility.test.tsx) — note: 6 pre-existing failures unrelated to this change (form-validation error text /aria-describedbywiring); out of scope here.Notes / follow-ups
--ringusages keep their fallback.LandingPage.accessibility.test.tsxare tracked as a separate concern from this PR.Files modified
frontend/src/styles/tokens.css— add--ring-strong(dark + light)frontend/src/styles/accessibility.css— focus ring, 44×44 targets, reduced motionfrontend/src/styles/__tests__/accessibility.css.test.ts— expanded suitefrontend/package.json—test:a11yJest flag