Skip to content

fix(a11y): WCAG AA hint/helper text contrast sweep - #15

Merged
Bissbert merged 1 commit into
mainfrom
fix/a11y-hints
May 5, 2026
Merged

Bissbert merged 1 commit into
mainfrom
fix/a11y-hints

Conversation

@Bissbert

@Bissbert Bissbert commented May 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Resolves the user-reported "hints not really readable" complaint with a WCAG 2.2 AA contrast sweep across hint, helper, and small-state text.
  • Audit at audits/T8-a11y-hints.md documents 27 specific findings; this PR implements the fix tier across 86 source files.
  • All edits are class-only — zero behaviour change, zero layout shift on rebuilt pages, full test suite green.

What changed

Pattern Before After Rationale
Form hints (FormFieldHint) text-xs text-slate-500 (12px @ 4.30:1 on bg-slate-50, fails AA) text-sm text-slate-600 (14px @ 7.24:1) One root edit cascades to every hint= consumer (calculators + GemIdentifier).
Calculator inline hints (9 files) text-xs text-slate-500 text-sm text-slate-600 7.59:1 on white.
Quiz / study / learn / docs surfaces text-{xs,sm} text-slate-500 (marginal 4.51:1) text-{xs,sm} text-slate-600 (7.59:1) Clears every visible-content slate-500 in the project.
Visible text-slate-400 (2.87:1 — hard fail) text-slate-400 text-slate-500 (4.51:1) Perl pattern preserves dark:, disabled:, placeholder:, hover:, group-hover:, peer-disabled:, focus: variants — dark mode and disabled-state semantics unchanged.
Copy-button & flag-button idle text-slate-400 hover:text-slate-600 text-slate-500 hover:text-slate-700 Maintains interactive contrast headroom.

Test plan

  • npm run build → 912 pages built, no errors
  • npm test -- --run → 210/210 tests pass
  • Spot-checked diff: 266 insertions / 266 deletions, all class-only
  • Post-merge: axe DevTools spot check on /tools/calculator, /tools/identification, /quiz, /study/settings, /learn/equipment/refractometer
  • Post-merge: Lighthouse a11y on the same routes (target: 100)

Audit reference

audits/T8-a11y-hints.md (included in this PR) carries the full per-finding table with computed contrast ratios, file:line citations, and the recommended token swap.

Per audit T8-a11y-hints (audits/T8-a11y-hints.md), the systemic use of
text-xs text-slate-500 and text-slate-400 across hint, helper, label
and small-state text produced contrast ratios from 2.87:1 to 4.51:1 —
either failing or borderline against WCAG SC 1.4.3 (Contrast Minimum)
on white and bg-slate-50 surfaces.

Changes:
- FormFieldHint (form/FormField.tsx) bumped to text-sm text-slate-600
  → fixes every FormField hint= consumer (calculators, GemIdentifier).
- All text-xs text-slate-500 in calculator hints upgraded to
  text-sm text-slate-600 (14px, 7.59:1 on white, 7.24:1 on slate-50).
- All text-{xs,sm} text-slate-500 → text-{xs,sm} text-slate-600 across
  src/ — clears every visible-content slate-500 instance.
- Unprefixed text-slate-400 (visible body text and UI affordances)
  bumped to text-slate-500 (4.51:1, well above 3:1 SC 1.4.11). The
  perl pattern preserves dark:, disabled:, placeholder:, hover:,
  group-hover:, peer-disabled:, focus: variants — dark mode and
  disabled-state semantics unchanged.
- Quiz/study surface (Quiz.tsx, Exam.tsx, QuizProgress.tsx,
  QuestionNav.tsx, RationalePanel.tsx, StudySettingsPanel.tsx) and
  GemIdentifier panels handled with the same color bump.
- Idle copy-button states (ResultCard.tsx, NumberResult.tsx) and the
  exam flag-button idle (Exam.tsx) bumped to slate-500 with a
  hover:text-slate-700 lift — keeps interactive contrast headroom.

Verification:
- npm run build → 912 pages built, no errors.
- npm test --run → 210/210 tests pass.
- 86 files changed, all class-only edits, no behaviour change.
@github-actions

github-actions Bot commented May 5, 2026

Copy link
Copy Markdown

🚀 Preview deployed to: https://f343970d.gemmology-dev.pages.dev

@Bissbert
Bissbert merged commit 0e3847a into main May 5, 2026
3 of 4 checks passed
Bissbert added a commit that referenced this pull request May 11, 2026
Per audit T8-a11y-hints (audits/T8-a11y-hints.md), the systemic use of
text-xs text-slate-500 and text-slate-400 across hint, helper, label
and small-state text produced contrast ratios from 2.87:1 to 4.51:1 —
either failing or borderline against WCAG SC 1.4.3 (Contrast Minimum)
on white and bg-slate-50 surfaces.

Changes:
- FormFieldHint (form/FormField.tsx) bumped to text-sm text-slate-600
  → fixes every FormField hint= consumer (calculators, GemIdentifier).
- All text-xs text-slate-500 in calculator hints upgraded to
  text-sm text-slate-600 (14px, 7.59:1 on white, 7.24:1 on slate-50).
- All text-{xs,sm} text-slate-500 → text-{xs,sm} text-slate-600 across
  src/ — clears every visible-content slate-500 instance.
- Unprefixed text-slate-400 (visible body text and UI affordances)
  bumped to text-slate-500 (4.51:1, well above 3:1 SC 1.4.11). The
  perl pattern preserves dark:, disabled:, placeholder:, hover:,
  group-hover:, peer-disabled:, focus: variants — dark mode and
  disabled-state semantics unchanged.
- Quiz/study surface (Quiz.tsx, Exam.tsx, QuizProgress.tsx,
  QuestionNav.tsx, RationalePanel.tsx, StudySettingsPanel.tsx) and
  GemIdentifier panels handled with the same color bump.
- Idle copy-button states (ResultCard.tsx, NumberResult.tsx) and the
  exam flag-button idle (Exam.tsx) bumped to slate-500 with a
  hover:text-slate-700 lift — keeps interactive contrast headroom.

Verification:
- npm run build → 912 pages built, no errors.
- npm test --run → 210/210 tests pass.
- 86 files changed, all class-only edits, no behaviour change.

This branch was successfully deployed

1 active deployment
gemmology-dev (Preview) — 60febcd0 Deployed May 5, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant