Skip to content

fix(minesweeper): tap-mode toggle readability + status.warning tint (#767) - #780

Merged
wei18 merged 1 commit into
mainfrom
feat/ms-tapmode-readability
Jul 12, 2026
Merged

wei18 merged 1 commit into
mainfrom
feat/ms-tapmode-readability

Conversation

@wei18

@wei18 wei18 commented Jul 11, 2026

Copy link
Copy Markdown
Owner

What

  • MS board's reveal/flag mode toggle (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.
  • Fixes fix(minesweeper): flag-mode toggle tints with status.warning — a mode selection is not a warning state #767: the flag-mode tint borrowed theme.status.warning, which design-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 with theme.accent.muted; icon/text switch to theme.text.primary on top of it for contrast (mirroring the existing accent.muted + text.primary pairing already used elsewhere for that token). Reveal keeps accent.primary with a white label. The two modes stay color-distinct without borrowing a status token.
  • Confirmed via grep -rn "status.warning" that MinesweeperBoardView.swift:628 was the only mode-selection use; MinesweeperCellButton's flagged-cell glyph is a separate, legitimate danger-marker use and is untouched.
  • 44pt minimum tap target preserved (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.
  • Re-recorded the MinesweeperUITests board 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.
  • Manually rendered a throwaway flag-mode snapshot (not committed) to confirm the accent.muted + text.primary treatment 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.
  • lefthook pre-commit (gitleaks + hygiene + swiftlint) passed on commit.

Not verified

  • No simulator/device visual QA (headless macOS host only); relied on re-recorded snapshot PNGs + a manual scratch render for visual confirmation.
  • Xcode Cloud / CI-only l10n fixture-sync gate (scan:l10n's fixture-sync half) not separately re-run beyond the local scan above.

🤖 Generated with Claude Code

…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
wei18 merged commit 4817b44 into main Jul 12, 2026
4 checks passed
@wei18
wei18 deleted the feat/ms-tapmode-readability branch July 12, 2026 14:05
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]>
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(minesweeper): flag-mode toggle tints with status.warning — a mode selection is not a warning state

1 participant