Skip to content

chore(polish): spacing token, MotionGate routing, mode-toggle contrast (#786 follow-ups) - #798

Merged
wei18 merged 1 commit into
mainfrom
chore/786-polish-followups
Jul 13, 2026
Merged

wei18 merged 1 commit into
mainfrom
chore/786-polish-followups

Conversation

@wei18

@wei18 wei18 commented Jul 13, 2026

Copy link
Copy Markdown
Owner

What

Closes #786 — the three non-blocking follow-ups from the #780/#783 reviews:

  1. Spacing literal: modeToggle .padding(.horizontal, 12) → theme.spacing.small (8). SpacingTokens names no 12 step; medium (16) is reserved for card-level internal padding. Tap target unaffected (explicit minWidth/minHeight: 44 frame).
  2. MotionGate consistency: BoardCellView error pulse routes reduce-motion through shared MotionGate via guard let — behavior identical (reduce-motion → no pulse at all; withAnimation(nil) would still dip the value one frame).
  3. Mode-toggle contrast: reveal-state label .white on accent.primary hard-failed dark-mode AA (2.35:1 on 0x7FAFCF). No text.* token passes (accent ramp flips opposite to text ramp) — switched to theme.surface.primary: 5.70:1 light / 6.96:1 dark, light mode byte-identical.

11 MS board baselines re-recorded (pixel-diff confined to the toggle chip bbox; light + dark eyeballed, incl. by the Leader). Terminal-overlay baselines pixel-identical, untouched.

Follow-ups filed from this pass

Verification

MinesweeperKit full suite 244/244 · SudokuKit BoardCell/BoardView/BoardSnapshot 26/26 · swiftlint --strict clean · pre-commit hooks green.

🤖 Generated with Claude Code

…ode-toggle contrast

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]>
@wei18
wei18 enabled auto-merge (squash) July 13, 2026 08:51
@wei18 wei18 changed the title chore(polish): #786 follow-ups — spacing token, MotionGate routing, mode-toggle contrast chore(polish): spacing token, MotionGate routing, mode-toggle contrast (#786 follow-ups) Jul 13, 2026
@wei18
wei18 merged commit efa986c into main Jul 13, 2026
7 of 8 checks passed
@wei18
wei18 deleted the chore/786-polish-followups branch July 13, 2026 08:55
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.

chore(polish): follow-ups from #780/#783 review — spacing token, MotionGate consistency, dark-mode contrast check

1 participant