Repository navigation
fix(sudoku): digit-first follow-ups — keyboard, VoiceOver armed state, exhausted+armed opacity - #799
Merged
Merged
Conversation
…, exhausted+armed opacity (#790) Re-audit 2026-07-13 found three MAJOR gaps in #781's digit-first input, all in BoardView/DigitPadView/BoardCellView: 1. `handleKeyPress`'s digit branch called `placeDigit(_:)` directly (via the now-removed `placeOrToggle`), which no-ops with no selection — Mac keyboard users had no way to arm a digit at all. Routes through the extracted `dispatchKeyboardDigit(_:)`, which calls `viewModel.keypadDigit(_:)` — the same arm/place/pencil-note dispatch the pointer-driven digit pad already uses. 2. An armed digit changes an empty cell's tap semantics (select → place) with zero VoiceOver signal — the cell's label still read only "Empty". `BoardCellView` now appends a localized "will place N" hint while armed, and `BoardView` posts an `AccessibilityNotification.Announcement` on arm/disarm. Three new catalog keys ("will place %lld", "Digit %lld armed", "Digit unarmed") across all 7 locales. 3. An exhausted-but-armed keypad digit dimmed to 0.35 opacity while still rendering `.borderedProminent` — looked disabled while staying interactive (armed digits are valid for notes use even when fully placed). Extracted `digitButtonOpacity(remaining: isArmed:)` excludes armed digits from the dim. `dispatchKeyboardDigit`, `accessibilityLabel` (BoardCellView), and `armedAnnouncementMessage`/`digitButtonOpacity` were widened from `private` specifically so the new tests exercise the REAL logic (confirmed red on pre-fix code via `git stash` + `swift test`) rather than a re-implementation that can't regress. SwiftUI's `KeyPress` has no public initializer (confirmed against Apple's Accessibility/ SwiftUI sample code), so `handleKeyPress` itself stays untested; `dispatchKeyboardDigit` is the closest testable seam. Verification: `swift test --package-path Packages/SudokuKit` — 303 tests / 63 suites pass (12 new); `mise run lint:swift_strict` 0 violations on changed files; `mise run scan:l10n` passes (2 catalogs, 7 locales complete). Sudoku-only — Minesweeper/GameShellKit untouched. Closes #790 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.
Summary
Re-audit 2026-07-13 (main@2609995) found three MAJOR gaps in #781's digit-first input, all fixed here:
Keyboard bypasses digit-first entirely —
handleKeyPress's digit branch calledplaceDigit(_:)directly (via the now-removedplaceOrToggle), which silently no-ops with no selection. Mac keyboard users had no way to arm a digit at all. Now routes through the extracteddispatchKeyboardDigit(_:)→viewModel.keypadDigit(_:), the same arm/place/pencil-note dispatch the pointer-driven digit pad already uses.VoiceOver gets no signal that tap semantics changed while armed — an armed digit changes an empty cell's tap from select → place with zero a11y signal (the cell's label still read only "Empty").
BoardCellViewnow appends a localized "will place N" hint while armed, andBoardViewposts anAccessibilityNotification.Announcementon arm/disarm. Three new catalog keys ("will place %lld", "Digit %lld armed", "Digit unarmed") across all 7 locales.Exhausted-but-armed keypad button mixed disabled/active visual language — an exhausted digit that's still armed (valid for notes use) dimmed to 0.35 opacity while rendering
.borderedProminent— looked disabled while staying interactive. ExtracteddigitButtonOpacity(remaining:isArmed:)excludes armed digits from the dim. (macDigitButtonhas no such gate — confirmed no analogous fix needed there.)dispatchKeyboardDigit,accessibilityLabel(BoardCellView), andarmedAnnouncementMessage/digitButtonOpacitywere widened fromprivatespecifically so the new tests exercise the REAL logic rather than a re-implementation that can't regress. SwiftUI'sKeyPresshas no public initializer (confirmed against Apple's Accessibility/SwiftUI sample code), sohandleKeyPressitself stays untested —dispatchKeyboardDigitis the closest testable seam.Closes #790
Test plan
swift test --package-path Packages/SudokuKit— 303 tests / 63 suites pass (12 new)git stashof production files only, re-ran — compile-time red on the new APIs:dispatchKeyboardDigit,armedDigitparam,armedAnnouncementMessage,digitButtonOpacity)mise run lint:swift_strict— 0 violations on changed filesmise run scan:l10n— 2 catalogs, 7 locales completerg -n "TODO|FIXME|stub"on the diff — zero hits🤖 Generated with Claude Code