Fix accordion/card-body contrast and outline-secondary legibility (Tokyo-11 sweep) - #456
Conversation
…contrast audit tool Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Follow-up commit: link colour (owner-approved open item 2)Owner asked to switch
Per this task's own "if any surface fails, do not force it, propose the minimal adjusted shade instead" instruction, Real production link verified ( New regression coverage: Not in this PR (owner-approved as a separate follow-up after this merges, to avoid two frontend branches colliding in |
Description
Owner found real contrast/residual-grey defects on live proxyprints.ca after the Tokyo-11 re-theme (#438) — this PR is the mechanical site-wide audit the owner asked for, plus the token-layer fix.
Root causes (all in
frontend/src/styles/styles.scss, wired before the Bootstrap/Superhero imports, same!default-preemption mechanism the rest of the theming layer uses, unless noted):$card-bg— Superhero's own_variables.scsssets$card-bg: $gray-600 !default;, a literal never actually derived from$secondarythe waydocs/features/theming.mdassumed. Under the old Sitewide retheme: adopt the /display reference-mockup aesthetic (palette, shapes) across the app #302 palette the two values coincided so the bug was invisible; Tokyo-11 changed$theme-panel-bgwithout changing$card-bg, and every unstyledCard.Body/Accordion.Body(incl. the/contributionsaccordion body) rendered Superhero's raw grey. Fixed:$card-bg: $theme-panel-bg;. Also fixes$accordion-bg(Superhero:$accordion-bg: $card-bg !default;).$accordion-button-active-bg/$accordion-button-active-color— Superhero sets these to$primary/$body-color !default. Tokyo-11's light orange + light text = 1.26:1. Owner's ruling on the defect: the orange fill is correct, only the ink is wrong — same fix pattern as the existing button-ink flip. Fixed: both (+ the chevron icon colour) routed to$theme-btn-ink..btn-outline-secondary— Bootstrap's outline-button generator necessarily reuses the same$theme-colorsmap entry the solid fill uses; Tokyo-11 intentionally repoints$secondaryto a near-background dark tone (correct for fills, wrong as a foreground/border colour), so all ~38.btn-outline-secondarymounts sitewide (the editor's "Showing: Fronts"/"Cardback", the restore-banner's "Dismiss") were ~1.2–1.4:1. Fixed by re-invoking Bootstrap's ownbutton-outline-variant()mixin with$theme-light— one global override, not a per-component patch.$code-color— Bootstrap core's unrouted$pinkdefault; every<code>tag sitewide (contributions guidelines, Syntax Guide) measured 3.19:1. Fixed:$code-color: $theme-info.$body-secondary-color/$body-secondary-bg—.text-muted's unrouted translucent default. Fixed: routed to$theme-muted/$theme-panel-bg.Footer.tsx'sColumnHeading— a hand-writtenrgba(255,255,255,.4), not a Bootstrap default and not a token, measured 3.61:1. Routed tovar(--theme-text).Full writeup (with every measured ratio) in
docs/features/theming.md's new "2026-07-25 contrast/residual-grey audit" section, which also corrects a wrong pre-existing claim about$card-bgand the$link-color"matches the pre-existing convention" claim (never actually measured until now).Before/after failure table
Measured via the new
frontend/tests/tooling/contrastAudit.ts(computed-style extraction, WCAG contrast against the owner's binding AAA bar — 7:1 normal, 4.5:1 large/bold), run across 10 states:/contributions(collapsed+expanded), the restore-draft banner, the Syntax Guide accordion (collapsed+expanded), the editor's mobile Print & Settings sheet, and a static-route sweep (/,/about,/explore,/myDecks,/whatsthat,/new) — all at 390px./contributionsaccordion header ("Contribution Guidelines")/contributionsaccordion body#4e5d6c$theme-panel-bg#2f3549<code>snippets (contributions, Syntax Guide)All 4 owner-reported defects: zero contrast failures after the fix, verified via a hard (non-allowlisted) assertion on the accordion header text specifically, plus screenshots (see Verification).
Open items (owner decision needed — not fixed by this PR)
Found by the sweep, deliberately left alone (either an already-ratified token's own known shortfall, a deliberate pre-existing convention needing an explicit replacement call, or a third-party library with no token seam):
$theme-muteditself falls short of strict-AAA (7:1) on raised/panel backgrounds — 6.39/6.68/5.34:1 measured. This is PR Fix reduced-motion gap in AutofillCollapse chevron #432's own already-ratified compromise; this pass just routes more surfaces (.text-muted, Footer's eyebrow labels) onto the same token, so the same known number now shows up in more places, not a new regression.$link-color(defaults to$primary) measures only 5.98:1 on panel — WORSE than the accent purpledocs/features/theming.md's own "Accent scope boundary" section rejected for prose (6.74:1) on the same kind of surface, and that claim was never actually measured until this audit. Needs an owner call on the replacement token — not fixed here since it'd change every plain<a>tag's colour sitewide.react-select's placeholder (/myDecks, literal white#ffffffdropdown on this dark theme, 3.95:1) andreact-dropdown-tree-select's tag pills (/explore,#dddddd/#000000). No Bootstrap/token seam reaches either — needs its own scoped override stylesheet, a distinct follow-up.$theme-dangeras plain text measures 6.46:1 — the SAME already-documented AAA-large-only exception for danger-as-button-ink, just recurring as paragraph text (/whatsthat's error message). Not new.These are captured in
tests/tooling/contrastAudit.ts'sisKnownOpenItem()allowlist (matched structurally, not by page) so the regression gate stays green without silently hiding them — they're logged viaconsole.logon every run.Checklist
pre-commitand installed the hooks withpre-commit installbefore creating any commits.frontend/tests/ContrastAudit.spec.ts+frontend/tests/tooling/contrastAudit.ts, a reusable audit tool + regression gate)frontend/tests/ContrastAudit.spec.tsbefore the fix (10/10 tests failing, 44 raw contrast failures) and after (10/10 passing, all remaining failures are the 4 documented open items above).DisplayLeftRailFidelity.spec.ts17 tests,CardbackPdfWaitFidelity.spec.ts,GeneralUIAccessibility.spec.ts,GridSelectorModal.spec.ts,SelectVersionSection.spec.ts,ImportText.spec.ts,DisplayFinishFooter.spec.ts,Navbar.spec.ts— 111 tests total) — all green, confirming the$card-bg/accordion/outline-secondary/$code-colorchanges don't regress anything spec-locked (including the untouchedoutline-dangerpill).npx tsc --noEmitclean,npx prettier@2.7.1 --checkclean on every changed file,next buildcompiles./contributionscollapsed + expanded, the restore-draft banner, the editor's mobile Print & Settings sheet (scrolled to show Cardback).docs/features/theming.mdedited in place — new "2026-07-25 contrast/residual-grey audit" section, two CORRECTION notes on stale prior claims, a new "The audit tool" section, a new Verification entry)Merge-time checklist