Repository navigation
fix(a11y): give on-accent labels an explicit AA-passing ink beyond #786's mode toggle - #808
Merged
Merged
Conversation
…'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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.primaryink)onAccentColorparam (MonetizationUI can't read .theme); sole call site threaded in MakeGameApp+ModifiersPlacement trap documented
.foregroundStylechained 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
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