Repository navigation
fix(minesweeper): tap-mode toggle readability + status.warning tint (#767) - #780
Merged
Merged
Conversation
…ing tint The reveal/flag mode toggle was icon-only, so a sighted player had no in-context hint of which mode was active or what a tap would do (the mode name was VoiceOver-only). The button now pairs its icon with the existing "Reveal"/"Flag" catalog strings (#742), matching the modes' own a11y labels. Fixes #767: flag mode's tint borrowed theme.status.warning, which design-system.md reserves for success/warning/error signaling, not mode selection — routine flag placement read as "something is wrong." Flag mode now tints with accent.muted (icon/text switch to text.primary for contrast, mirroring the existing accent.muted + text.primary pattern used elsewhere for that token), keeping the two modes color-distinct without the warning connotation. Confirmed via grep that MinesweeperBoardView.swift:628 was the only status.warning use for mode-selection; MinesweeperCellButton's flagged-cell glyph is a different, legitimate danger-marker use and is unchanged. Re-recorded the MinesweeperUITests board snapshot baselines that render the toggle (covered/mid-reveal/flagged/mine-hit, iPhone + iPad, light + dark) to match the new button. Co-Authored-By: Claude Fable 5 <[email protected]>
wei18
added a commit
that referenced
this pull request
Jul 12, 2026
… + text) (#787) MinesweeperPracticeHubView carried zero theme.* references — the difficulty picker took the system tint, the Start CTA rendered system blue, and text used .primary/.secondary. The one screen where a new MS player picks a difficulty had no brand/difficulty color identity, unlike Sudoku's PracticeHubView (audit finding #765). Mirrors Sudoku's reference shape exactly: @Environment(\.theme), surface.background + text.primary threaded into PracticeHubShellView, text tokens on the card labels, and one difficulty-derived tint (beginner/intermediate/expert -> difficulty.easy/medium/hard per MinesweeperTheme's own mapping) shared by the segmented picker and the CTA so the two stay visually linked. No snapshot baselines exist for this view (deliberately deferred per the test file's header), so no re-records; visual verification via a temporary record-mode snapshot, eyeballed in light/Beginner (slate-blue picker+CTA on blueprint-paper background) and dark/Expert (rose picker+ CTA on dark surface), then removed — working tree carries only this one source change. Verification: MinesweeperKit full suite 240/240; swift build clean; swiftlint --strict 0 violations. (Sibling audit finding #767 needed no work — already fixed by PR #780.) Closes #765 Co-authored-by: Claude Fable 5 <[email protected]>
wei18
added a commit
that referenced
this pull request
Jul 13, 2026
…ode-toggle contrast (#798) Three non-blocking follow-ups from the #780/#783 reviews (issue #786): 1. Spacing literal (MinesweeperBoardView.modeToggle): `.padding(.horizontal, 12)` snapped to `theme.spacing.small` (8) — SpacingTokens names no 12 step, and `medium` (16) is reserved by the design-system pairing table for card-level internal padding. The chip's `.frame(minWidth: 44, minHeight: 44)` keeps the HIG tap-target floor independent of the padding value. 2. MotionGate consistency (SudokuKit BoardCellView error pulse): the hand-written `guard !reduceMotion` now routes through the shared `MotionGate.animation(_:reduceMotion:)` via `guard let`, matching the two `.animation` modifiers in the same file. `guard let` (not `withAnimation(nil)`) keeps behavior identical: reduce-motion on means no pulse at all — the opacity value never dips. 3. Mode-toggle contrast (MinesweeperBoardView.modeToggle reveal state): `.white` on `accent.primary` hard-failed AA in dark mode. WCAG ratios: - before: white / 0x3E6B8C light = 5.70:1 (pass); white / 0x7FAFCF dark = 2.35:1 (FAIL) - no text.* token passes dark either (text.primary 0xEEF1F4 / 0x7FAFCF = 2.07:1) — the accent ramp flips light<->dark opposite to the text ramp - after: `theme.surface.primary` (0xFFFFFF light / 0x1C2026 dark) = 5.70:1 light / 6.96:1 dark — both AA (>= 4.5:1). Light mode renders byte-identically (still white). Re-recorded the 11 MS board baselines that contain the mode toggle (covered light/dark/iPad, banner-reserved light/dark, flagged/midReveal/mineHit light/dark); terminal-overlay baselines are pixel-identical (overlay covers the toggle) and were left untouched. Pixel-diff confined to the toggle chip bbox in every re-recorded PNG; eyeballed light (white on slate, narrower chip) and dark (dark ink on light blue, readable). Note for the record: the first re-record attempt captured Flag mode because the swiftpm test host's UserDefaults domain (`swiftpm-testing-helper`) carried a leaked `com.wei18.minesweeper.board.tapMode = flag` from an earlier run (#720 G3 seeds the toggle from UserDefaults.standard at view init). The key was cleared before the final recording; the snapshot render's dependence on host defaults remains a latent recording hazard. Part of #786. 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
MinesweeperBoardView.swift:612-651) is icon-only today; a sighted player gets no in-context hint of the active mode or what a tap will do (the mode name was VoiceOver-only). The button now pairs the existing icon with a text label using the catalog strings already shipped for this control ("Reveal"/"Flag", chore(l10n): localize MS board control strings and Sudoku cache-cleared toast #742) — no new l10n needed.theme.status.warning, whichdesign-system.md's token table reserves for success/warning/error signaling, not mode selection. Routine flag placement read as "something is wrong." Flag mode now tints withtheme.accent.muted; icon/text switch totheme.text.primaryon top of it for contrast (mirroring the existingaccent.muted+text.primarypairing already used elsewhere for that token). Reveal keepsaccent.primarywith a white label. The two modes stay color-distinct without borrowing a status token.grep -rn "status.warning"thatMinesweeperBoardView.swift:628was the only mode-selection use;MinesweeperCellButton's flagged-cell glyph is a separate, legitimate danger-marker use and is untouched.frame(minWidth: 44, minHeight: 44)).Why
Both issues came out of the same control and the same audit round (
meetings/2026-07-11_design-db-uiux-audit.md): icon-only mode switching is a discoverability gap for new players, and the warning-toned flag tint sends the wrong signal for a normal input mode.Evidence / verification
swift build(MinesweeperKit package): clean.swift test --filter MinesweeperUITests(MinesweeperKit package): 197/197 passed, including the board snapshot suites.MinesweeperUITestsboard snapshot baselines that render the toggle (covered / mid-reveal / flagged / mine-hit, iPhone + iPad, light + dark) — the previous baselines still technically passed under the suite's 95%-tolerant image diff (the button is a small fraction of the frame) but were visually stale; re-recorded so they reflect the new button for the Designer's visual-verification use of these PNGs.accent.muted+text.primarytreatment is legible; discarded after review.mise run lint:swift: clean.mise run scan:l10n: passes (0 placeholders, all 7 locales — no new keys needed, reused existing catalog entries).mise run scan:hygiene/ gitleaks: clean.Not verified
scan:l10n's fixture-sync half) not separately re-run beyond the local scan above.🤖 Generated with Claude Code