Skip to content

fix(a11y): give on-accent labels an explicit AA-passing ink beyond #786's mode toggle - #808

Merged
wei18 merged 1 commit into
mainfrom
fix/797-on-accent-ink
Jul 14, 2026
Merged

wei18 merged 1 commit into
mainfrom
fix/797-on-accent-ink

Conversation

@wei18

@wei18 wei18 commented Jul 14, 2026

Copy link
Copy Markdown
Owner

What

Closes #797 — dark-mode white-on-accent AA failures across every live .borderedProminent + accent-tint surface, beyond the mode toggle #786 fixed.

Fixed (11 sites, all label-content theme.surface.primary ink)

  • Sudoku DigitPad armed digits (compact + Mac) and macNotesToggle: dark 2.20 → 7.42
  • Shared CompletionOverlayScaffold CTAs + PauseOverlayView Resume: Sudoku 4.83/7.42, MS 5.70/6.96
  • MS detonated-mine glyph: dark 3.36 → 4.87 (held to 4.5 — glyph is below large-text size at the 32pt cell floor)
  • ReminderPrimerSheet accept (incl. spinner tint) + openSettings CTAs: 7.42/6.96 per ramp
  • Both apps' Practice hub CTAs (all difficulty tints failed dark; now 4.92–9.72)
  • ATTPrimerSheet Continue via a minimal backward-compatible onAccentColor param (MonetizationUI can't read .theme); sole call site threaded in MakeGameApp+Modifiers

Placement trap documented

.foregroundStyle chained after .buttonStyle(.borderedProminent) is silently ignored — every fix places the ink on the label content inside the Button closure; caught in round 1 by rendered-PNG eyeball, and the Sudoku draw CTA's ink is scoped to the enabled branch (explicit ink otherwise defeats system disabled dimming — the committed baseline caught that).

Completeness + contract

  • Repo-wide enumeration: every non-test borderedProminent site fixed / passing-with-ratio / documented dead code (both apps' CompletionView closeButtons) / deliberately untouched (DailyHub exhausted Practice — untinted system prominent, 4.02/3.65) — reviewer re-verified by independent grep.
  • New contract gate: SurfaceTokens.primary doc contract + per-app-theme WCAG tests (≥4.5 both modes) so a future game-N palette can't silently regress this class.
  • Known residual tracked as fix(a11y): practice-hub CTA light-mode contrast — white on medium/hard difficulty tints fails AA (token-level) #806: practice-hub LIGHT-mode white on medium/hard tints (3.19/2.08) is token-level (needs ramp/on-tint-token design), documented in code comments.

Verification

GameShellKit 21/21 · SettingsKit 31/31 · GameAppKit 35/35 · AppMonetizationKit 120/120 · MinesweeperKit 259/259 · SudokuKit partitioned batches 0 failures · swiftlint --strict clean · zero snapshot churn (light mode byte-identical by construction; representative dark renders eyeballed).
Dual code review: mechanical APPROVE (8/8) + adversarial round-2 APPROVE (all ratios independently recomputed to 2 decimals; enumeration cross-checked by independent grep; round-1-approved files byte-identical across the amend).

🤖 Generated with Claude Code

…'s mode toggle

#786 fixed the MS mode-toggle's dark-mode white-on-accent AA failure. This
applies the same `surface.primary`-as-ink pattern to every remaining live
prominent+accent-tint surface found by a full-repo `borderedProminent` sweep
(CR round 2 widened the round-1 four-surface scope):

- Sudoku DigitPadView — armed digit (compact + mac) and macNotesToggle
- Shared CompletionOverlayScaffold (Play Again / Close) + PauseOverlayView
  (Resume) — both apps
- MS MinesweeperCellButton — detonated-mine glyph
- Shared ReminderPrimerSheet (SettingsKit) — accept CTA (text + spinner)
  and iOS openSettings CTA — both apps
- Shared ATTPrimerSheet (MonetizationUI) — Continue CTA, via a new injected
  `onAccentColor` param (default `.white`) threaded from
  GameAppKit.universalRootModifiers, since MonetizationUI deliberately
  cannot read `\.theme`
- Practice hub draw/start CTAs (Sudoku PracticeHubView + MS
  MinesweeperPracticeHubView) — difficulty-tinted; dark mode failed on
  every tint. Sudoku's CTA applies the ink only while enabled: the
  disabled/shimmer state keeps the system's disabled dimming (committed
  shimmer baseline stays byte-identical).

Implementation note: `.foregroundStyle` must be applied to the label
CONTENT inside the Button closure, not chained after
`.buttonStyle(.borderedProminent)` — the prominent style resolves its own
white label ink internally and ignores an ambient `.foregroundStyle` on the
Button. Caught by rendering fresh dark-mode PNGs before committing (the
first pass rendered unchanged white); re-verified after moving the modifier.

Contract gate (CR round 2 item 5): `SurfaceTokens.primary` (GameShellUI)
now documents the on-accent-ink contract — surface.primary must clear
4.5:1 against accent.primary in BOTH modes — and each app theme gains a
WCAG-ratio unit test (SudokuKit ThemeTests
`DefaultThemeOnAccentContrastTests`, MinesweeperKit
`MinesweeperThemeContrastTests`) so a future game-N palette cannot silently
reintroduce this class.

Ratio table (old white ink → new `surface.primary` ink), WCAG
relative-luminance formula against each theme's real hex values:

| Surface | Background | Light before→after | Dark before→after |
|---|---|---|---|
| Sudoku armed digit / macNotesToggle | accent.primary 0x5C7A4F/0x9BB87E | 4.83 → 4.83 (unchanged) | 2.20 FAIL → 7.42 |
| Scaffold + Pause CTAs (Sudoku ramp) | accent.primary 0x5C7A4F/0x9BB87E | 4.83 → 4.83 | 2.20 FAIL → 7.42 |
| Scaffold + Pause CTAs (MS ramp) | accent.primary 0x3E6B8C/0x7FAFCF | 5.70 → 5.70 | 2.35 FAIL → 6.96 |
| ReminderPrimer accept / openSettings; ATT Continue (Sudoku ramp) | accent.primary | 4.83 → 4.83 | 2.20 FAIL → 7.42 |
| ReminderPrimer accept / openSettings; ATT Continue (MS ramp) | accent.primary | 5.70 → 5.70 | 2.35 FAIL → 6.96 |
| Sudoku practice draw CTA | difficulty easy/medium/hard | 4.83 / 3.19* / 2.08* (unchanged) | 2.20/2.37/1.68 FAIL → 7.42/6.89/9.72 |
| MS practice start CTA | difficulty Beginner/Intermediate/Expert | 5.70 / 3.19* / 5.85 (unchanged) | 2.35/2.37/3.32 FAIL → 6.96/6.90/4.92 |
| MS detonated-mine glyph | mineHit 0xC8362B/0xE66258 | 5.23 → 5.23 | 3.36 FAIL (glyph ≈17.6pt at the 32pt floor — below WCAG large-text, held to 4.5) → 4.87 |

*KNOWN RESIDUAL (pre-existing, unchanged by this fix): the practice-hub
LIGHT-mode white ink on the medium (0xC97D5F, 3.19:1) and Sudoku-hard
(0xE6A857, 2.08:1) difficulty tints also fails AA — surface.primary is
white in light mode and cannot help; needs a token-level fix (darker
light-ramp difficulty tints or per-difficulty ink). Documented in both
CTAs' comments; #797 follow-up.

Full `borderedProminent` enumeration (non-test sources) — remaining sites
NOT changed, with reason:
- MinesweeperBoardView.swift:701 mode toggle — fixed by #786 (5.70/6.96).
- MinesweeperCompletionView.swift closeButton + Sudoku
  CompletionView.swift closeButton — dead code in production: every live
  call site (both apps' board overlays + both LiveRouteFactory pushed
  routes) passes `onClose: nil`, so the button never renders outside
  fixtures; untinted (system blue), not on any theme accent. Left
  unchanged.
- Sudoku DailyHubView.swift:89 exhausted-state "Practice" — untinted
  system-default prominent (no theme accent involved; white on systemBlue
  4.02 light / 3.65 dark, the platform's own default idiom). Out of #797's
  white-on-theme-accent class; flagged for the same token follow-up.
- GameShellUI NeutralTheme (previews-only fallback): white on its dark
  accent 0xAEAEB2 = 2.21 would fail, but with the fixed call sites it now
  gets surface.primary 0x2C2C2E = 6.30; light 5.99. Passing.

Verification:
- swift test: GameShellKit 21/21 · SettingsKit 31/31 · GameAppKit 35/35 ·
  AppMonetizationKit 120/120 · MinesweeperKit 259/259 (full suites) ·
  SudokuKit across three filter/skip-partitioned batches (141 + 76 + 107),
  0 failures (pre-existing local full-suite segfault, documented on
  unmodified main, avoided by partitioning; the touched-surface batch
  Board|Digit|Completion|Theme|GameViewModel|Practice is fully green).
- swiftlint --strict on all 12 changed files: 0 violations.
- Snapshots: zero baseline changes. Light mode is byte-identical
  everywhere (surface.primary light = 0xFFFFFF = the prior default white);
  the one baseline my round-2 change DID break (Sudoku practice shimmer —
  disabled-state dimming overridden) was fixed by scoping the ink to the
  enabled state, not by re-recording.
- Visual: fresh temporary dark renders (deleted before commit) for the
  armed digit, both overlay CTAs, mine glyph, macNotesToggle, reminder
  primer accept, and the MS practice hub (Beginner + Expert — Expert's
  4.92 is the batch's tightest ratio); all legible. The iOS-only
  openSettings CTA can't render on the macOS test host — ratio-verified
  only (identical pattern).

Closes #797

Co-Authored-By: Claude Fable 5 <[email protected]>
@wei18
wei18 enabled auto-merge (squash) July 14, 2026 01:37
@wei18
wei18 merged commit e9a959f into main Jul 14, 2026
4 checks passed
@wei18
wei18 deleted the fix/797-on-accent-ink branch July 14, 2026 01:38
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.

fix(a11y): dark-mode white-on-accent AA failures beyond #786 — DigitPad armed digit, completion/pause prominent buttons, mine glyph

1 participant