fix(frontend): audit and fix WCAG AA colour contrast (closes #382) - #453
fix(frontend): audit and fix WCAG AA colour contrast (closes #382)#453Olajcodes wants to merge 4 commits into
Conversation
…Ecosystem#382) Audit all design-token colour pairings against WCAG AA (4.5:1 normal text, 3:1 large text) and fix the three tokens that fell below the threshold. Before → After (ratio on #FAFAF7 background): accent: #E85D3A (3.31:1) → #C2410C (4.95:1) success: #22C55E (2.18:1) → #15803D (4.80:1) error: #EF4444 (3.60:1) → #DC2626 (4.62:1) Changes: - tailwind.config.ts: updated accent, success, error hex values - globals.css: updated --accent, --success, --error CSS variables - __tests__/contrast.test.ts: new automated Jest suite that validates all text-on-bg, white-on-colour, and text-on-white pairings against WCAG AA thresholds (16 assertions)
|
@Olajcodes 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! 🚀 |
📝 WalkthroughWalkthroughThe backend hardens TTL-warning handling, updates test isolation, and adds dependencies. The frontend improves form accessibility and validation, stabilizes theme rendering, and adds WCAG contrast checks with updated color tokens. ChangesBackend hardening
Frontend accessibility and form behavior
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 2 | ❌ 3❌ Failed checks (2 warnings, 1 inconclusive)
✅ Passed checks (2 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Hi @Olajcodes, This PR could not be merged because it has merge conflicts with the target branch. Please resolve the merge conflicts, push the updated changes, and the PR can be reviewed and merged. Thank you! |
|
@ritik4ever I have resolved the conflicts. Kindly check through and merge |
…oses Stellar-Ecosystem#382) The previous main merge (210d136) introduced duplicate color keys in tailwind.config.ts, which broke tsc (TS1117) and silently neutralized the success/error contrast fixes. Resolve the conflict properly: keep main's var() references for theme colors (dark-mode aware) and the WCAG AA-fixed hexes for success (#15803D) and error (#DC2626). Also resolves the remaining pre-existing CI failures inherited from main (all verified identical to upstream/main, fixes reused from the fix/381 and fix/383 branches): - Frontend: drop unsupported focus:ring-primary/30 opacity modifier (CSS-var color) in globals.css; ThemeProvider always renders its context so useTheme no longer crashes during prerender; RegisterForm labels now use htmlFor/id, price input uses type=text + inputMode=decimal, submit disabled via live validation; fixed 2 syntax errors in RegisterForm.test.tsx; mocked useTheme in Navbar.test.tsx (jsdom lacks matchMedia). - Backend: add missing pino-http and rate-limit-redis deps; remove duplicate annotateTtlWarning declaration; demo tests mock services.js and stub global fetch for the AbortError path. - Contract: bump ethnum 1.5.2 -> 1.5.3 in Cargo.lock (current stable Rust cannot compile 1.5.2). Validated locally: frontend tsc + next build + 21/21 suites (128 tests), backend 310/310 tests + npm ci under node 22, contrast suite 16/16.
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@frontend/__tests__/contrast.test.ts`:
- Around line 40-53: Update the contrast test’s TOKENS setup to consume the
production color tokens from the existing shared configuration, such as
globals.css or tailwind.config.ts, instead of duplicating hex values locally.
Ensure contrast calculations use the current configured values, including
BACKGROUND, FOREGROUND, and each TOKENS entry.
In `@frontend/app/globals.css`:
- Line 69: Update the input styling in frontend/app/globals.css at lines 69-69
to use a border token with at least 3:1 contrast against --background, replacing
border-border while preserving the other styles. Add a corresponding 3:1
contrast assertion for border against BACKGROUND in
frontend/__tests__/contrast.test.ts at lines 120-125.
In `@frontend/tailwind.config.ts`:
- Line 20: Update the error token in frontend/tailwind.config.ts at lines 20-20
to a darker value that achieves at least 4.5:1 contrast when rendered over the
5% error-tinted background. In frontend/__tests__/contrast.test.ts lines 94-108,
composite the error color at 5% opacity over BACKGROUND and assert text-error
contrast against the resulting color.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: f921e7d1-039a-435a-afea-af14c8db96e1
⛔ Files ignored due to path filters (2)
backend/package-lock.jsonis excluded by!**/package-lock.jsoncontract/Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (10)
backend/package.jsonbackend/src/routes/registry.jsbackend/test/demo.test.jsfrontend/__tests__/Navbar.test.tsxfrontend/__tests__/RegisterForm.test.tsxfrontend/__tests__/contrast.test.tsfrontend/app/globals.cssfrontend/components/RegisterForm.tsxfrontend/components/ThemeProvider.tsxfrontend/tailwind.config.ts
💤 Files with no reviewable changes (2)
- frontend/components/ThemeProvider.tsx
- backend/src/routes/registry.js
|
@ritik4ever kindly merge. All checks passed already. |
Summary
Closes #382
Audits all design-token colour pairings against WCAG AA thresholds, fixes three failing tokens, and adds an automated contrast test to prevent regressions.
Contrast Audit Results
#E85D3A#C2410C#22C55E#15803D#EF4444#DC2626#6B6B6B#1A1A1AAll pairings now meet WCAG AA for normal text (≥4.5:1) and large text (≥3:1).
Changes
tailwind.config.tsaccent:#E85D3A→#C2410C(orange-700)success:#22C55E→#15803D(green-700)error:#EF4444→#DC2626(red-600)globals.css--accent,--success,--errorCSS variables to match__tests__/contrast.test.ts(new)#FAFAF7background (5 pairings)Testing
Summary by CodeRabbit
Accessibility
Bug Fixes