fix(a11y): improve contrast on mono labels for WCAG AA compliance#558
fix(a11y): improve contrast on mono labels for WCAG AA compliance#558aafre wants to merge 2 commits into
Conversation
Adds accent-text (#007a48, 5.18:1 on chalk) Tailwind token for mono eyebrow labels that were using text-accent (#00d47e, ~1.87:1) on light backgrounds — a Lighthouse WCAG AA failure. Replaces text-accent with text-accent-text in all 63 light-background mono label instances across 20 files. Preserves text-accent on the dark CTA section (bg-ink) where it passes contrast at ~10:1. Also fixes two additional Lighthouse-flagged failures on the homepage: - Hero trust badge (p.font-mono text-xs): text-stone-warm → text-ink/60 - Company marquee disclaimer (p.text-xs): text-stone-warm → text-ink/60 Both stone-warm (#8a8680) instances were ~3.46:1 on chalk — below the 4.5:1 WCAG AA threshold for text-xs (12px) content.
There was a problem hiding this comment.
Code Review
This pull request introduces a new Tailwind color configuration, accent-text (#007a48), and updates various components to use text-accent-text instead of text-accent for eyebrow and header text elements. It also updates some text colors in LandingPage.tsx from text-stone-warm to text-ink/60. The reviewer identified accessibility issues in BlogIndex.tsx, AIResumePromptsHub.tsx, and ResumeKeywordsHub.tsx, where using text-accent-text inside dark containers reduces the contrast ratio below WCAG AA guidelines (minimum 4.5:1). Reverting these specific elements back to text-accent is recommended to maintain readability and compliance.
|
|
||
| <div className="relative"> | ||
| <span className="font-mono text-xs tracking-[0.15em] text-accent uppercase"> | ||
| <span className="font-mono text-xs tracking-[0.15em] text-accent-text uppercase"> |
There was a problem hiding this comment.
This label is rendered inside a dark container (bg-ink). Changing the text color from text-accent (#00d47e) to text-accent-text (#007a48) reduces the contrast ratio to ~3.38:1, which violates WCAG AA guidelines for small text (minimum 4.5:1). It should remain text-accent on dark backgrounds to maintain readability and compliance.
| <span className="font-mono text-xs tracking-[0.15em] text-accent-text uppercase"> | |
| <span className="font-mono text-xs tracking-[0.15em] text-accent uppercase"> |
There was a problem hiding this comment.
@gemini-code-assist Good catch — fixed in 66be5a9. This is the dark CTA section (bg-ink) identical to the LandingPage case I already handled. Restored to text-accent (#00d47e) which gives ~10:1 on the dark background.
There was a problem hiding this comment.
Thank you for addressing the contrast issue. It's great to hear that restoring text-accent resolves the WCAG AA compliance for this dark background section.
| /> | ||
| <div className="relative z-10"> | ||
| <span className="font-mono text-xs tracking-[0.15em] text-accent uppercase mb-6 block"> | ||
| <span className="font-mono text-xs tracking-[0.15em] text-accent-text uppercase mb-6 block"> |
There was a problem hiding this comment.
This label is rendered inside a dark container (bg-ink). Changing the text color from text-accent (#00d47e) to text-accent-text (#007a48) reduces the contrast ratio to ~3.38:1, which violates WCAG AA guidelines for small text (minimum 4.5:1). It should remain text-accent on dark backgrounds to maintain readability and compliance.
| <span className="font-mono text-xs tracking-[0.15em] text-accent-text uppercase mb-6 block"> | |
| <span className="font-mono text-xs tracking-[0.15em] text-accent uppercase mb-6 block"> |
There was a problem hiding this comment.
@gemini-code-assist Good catch — fixed in 66be5a9. This is the dark CTA section (bg-ink) identical to the LandingPage case I already handled. Restored to text-accent (#00d47e) which gives ~10:1 on the dark background.
There was a problem hiding this comment.
Thanks for the clarification, aafre. That makes sense. Since you've already verified that the contrast ratio is ~10:1 on the dark background, keeping text-accent in that specific section is the correct approach for both accessibility and design consistency.
| <div className="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[400px] h-[300px] rounded-full bg-accent/[0.07] blur-3xl pointer-events-none" /> | ||
| <div className="relative"> | ||
| <span className="font-mono text-xs tracking-[0.15em] text-accent uppercase mb-3 block">FREE TOOL</span> | ||
| <span className="font-mono text-xs tracking-[0.15em] text-accent-text uppercase mb-3 block">FREE TOOL</span> |
There was a problem hiding this comment.
This label is rendered inside a dark container (bg-ink). Changing the text color from text-accent (#00d47e) to text-accent-text (#007a48) reduces the contrast ratio to ~3.38:1, which violates WCAG AA guidelines for small text (minimum 4.5:1). It should remain text-accent on dark backgrounds to maintain readability and compliance.
| <span className="font-mono text-xs tracking-[0.15em] text-accent-text uppercase mb-3 block">FREE TOOL</span> | |
| <span className="font-mono text-xs tracking-[0.15em] text-accent uppercase mb-3 block">FREE TOOL</span> |
There was a problem hiding this comment.
@gemini-code-assist Good catch — fixed in 66be5a9. This is the dark CTA card (bg-ink) identical to the LandingPage case I already handled. Restored to text-accent (#00d47e) which gives ~10:1 on the dark background.
There was a problem hiding this comment.
Thank you for the clarification, @aafre. That makes perfect sense. Since the bg-ink container provides sufficient contrast, reverting to text-accent is indeed the correct approach to maintain both accessibility and the intended visual design. I have no further concerns regarding this specific component.
…ents BlogIndex, AIResumePromptsHub, and ResumeKeywordsHub each have a dark CTA section (bg-ink) where the bright green text-accent (#00d47e) passes contrast at ~10:1 — the darker text-accent-text (#007a48) would have dropped to ~3.38:1 on the dark background, a WCAG regression. Caught by Gemini code review on PR #558.
Summary
Lighthouse mobile audit on the homepage flagged three WCAG AA contrast failures on small text. This PR fixes all three by introducing a higher-contrast green token for mono eyebrow labels and darkening two specific small-text instances that used
text-stone-warmattext-xssize.Failing nodes (before):
section.relative > … > span.font-mono—text-accent(#00d47e) on chalk = ~1.87:1 ❌section.relative > … > p.font-mono—text-stone-warm(#8a8680) at text-xs on white = ~3.46:1 ❌section.bg-chalk > … > p.text-xs—text-stone-warmat text-xs on chalk = ~3.46:1 ❌WCAG AA requires 4.5:1 for normal/small text (< 18px).
Changes
tailwind.config.jsaccent-text: '#007a48'token (5.18:1 on chalk ✅)text-accent→text-accent-textin all 63 light-bg mono eyebrow labelsLandingPage.tsx:631text-accenton dark CTA section (bg-ink) where it passes at ~10:1LandingPage.tsx:225text-stone-warm→text-ink/60on hero trust badge (text-xs)LandingPage.tsx:322text-stone-warm→text-ink/60on company marquee disclaimer (text-xs)Contrast ratios after fix:
#007a48on chalk (#fafaf8): 5.18:1 ✅ passes WCAG AA for small texttext-ink/60on chalk: ~4.59:1 ✅ passes WCAG AA for small texttext-accenton ink (#0c0c0c, dark CTA): ~10:1 ✅ unchangedTest plan
npx vitest run— 1445 tests pass, 0 failurestext-accentRisk: LOW
CSS color-only change across 21 files. Rollback =
git revert HEAD. No layout, logic, or data changes.Note: 48h attribution gap
Per project convention, hold merge until ≥48h after PR #556 (VideoObject removal) merges so GSC impression movement can be cleanly attributed to each change.
Related
C:\Users\Amit\.claude\plans\stg-backlog-context.md