Repository navigation
fix(board): cap chrome + digit-pad Dynamic Type to fix accessibility clipping (#540) - #547
Merged
Merged
Conversation
…ing dynamicTypeSize (#540) The prior approach gated a two-row header reflow on `@Environment(\.dynamicTypeSize).isAccessibilitySize`. Inside the fullScreenCover modal that hosts BoardView (via GameRoot), that environment value reads a stale `.large` even while the Text views scale via UIFont metrics, so the gate never fired on device — difficulty still clipped to "ledium" off the leading edge (a11y x0 = -19 at AX3 / -37 at AX5), and the digit pad still rendered blank. Header (BoardView+AccessibilityHeader.swift, extracted to keep BoardView.swift < 400 lines): - Replace the env-gated branch with `ViewThatFits(in: .horizontal)`: SwiftUI picks the single-row HStack when it fits the ACTUAL offered width and falls back to a two-row VStack when the enlarged labels overflow. No environment read. At default sizes the HStack fits → snapshot baseline unchanged. - Add `.lineLimit(1).minimumScaleFactor(0.6)` to the difficulty + timer labels so whichever layout is chosen shrinks text to fit instead of pushing it to a negative-x frame. Digit pad (DigitPadView.swift): - Root cause of the blank pills: the digit overflows VERTICALLY. At AX sizes the glyph is ~50-60 pt tall but the .bordered pill is ~44 pt; the bare `frame(minHeight: 44)` set only a floor (no ceiling), so the Text was proposed unbounded height, never scaled, grew to full AX height, and was clipped top-and-bottom to nothing. A width-based minimumScaleFactor cannot fix a height overflow. - Fix: bound the glyph to a CEILING height (`maxHeight: 28`, inside the 44 pt pill) so `minimumScaleFactor(0.3)` has a concrete box to scale the digit down into. At default size the digit's natural height < 28 pt, so no scaling occurs and the baseline is preserved. Minesweeper mirror (MinesweeperBoardView.swift): same ViewThatFits status-bar reflow (single-row HStack → two-row VStack) with shrink-to-fit labels. No environment value drives layout in any of these. #539 scenePhase code untouched. Default-size snapshot baselines verified byte-identical: SudokuKit 255/255, MinesweeperKit 183/183. Per the round-3 directive, NO snapshot test is added — the injected-env snapshot gave a false pass before; the Leader will sim-verify AX3/AX5 on device. Co-Authored-By: Claude <[email protected]>
…ing (#540) At accessibility text sizes the board header clipped the difficulty/timer labels off the leading edge and the digit-pad 1-9 rendered BLANK (empty pills). Root cause: a single digit overflows VERTICALLY (glyph far taller than the 44pt pill) and `minimumScaleFactor` is width-driven so it never engages for a 1-char label — the tall glyph just clipped to nothing; the header labels likewise scaled tall and pushed off-screen, and the earlier `dynamicTypeSize.isAccessibilitySize` gate read a stale `.large` inside the fullScreenCover modal so the reflow never fired. Fix: cap the compact board chrome (header) and the digit pad at `.dynamicTypeSize(...DynamicTypeSize.xLarge)` so they stay legible inside their fixed-size controls regardless of the system AX setting (standard compact-control convention). The cap clamps only ABOVE `.xLarge`, so default `.large` rendering — and every committed snapshot — is byte-identical. The board CELLS are uncapped and keep scaling for puzzle readability. Mirrored to Minesweeper's status bar. Keeps the round-3 `ViewThatFits` header structure (extracted to BoardView+AccessibilityHeader.swift, no file_length disable). Sim-verified on iPhone 17 Pro at AX5: digit pad 1-9 now visible, header difficulty/timer/pause no longer clip off the left edge. Co-Authored-By: Claude Opus 4.8 <[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.
Fixes #540.
At accessibility text sizes (AX3+) the board header clipped the difficulty/timer labels off the left edge and the digit pad 1–9 rendered BLANK (empty pills, unusable).
Root cause: a single digit overflows VERTICALLY (glyph far taller than the 44pt pill);
minimumScaleFactoris width-driven and never engages for a 1-char label, so the tall glyph clipped to nothing. The header labels likewise scaled tall and pushed off-screen, and an earlierdynamicTypeSize.isAccessibilitySizegate read a stale.largeinside the fullScreenCover modal so a reflow never fired.Fix: cap the compact board chrome (header) and the digit pad at
.dynamicTypeSize(...DynamicTypeSize.xLarge)— they stay legible inside their fixed-size controls regardless of the system AX setting. The cap clamps only ABOVE.xLarge, so default.largerendering and every committed snapshot are byte-identical. Board CELLS are uncapped and keep scaling. Mirrored to Minesweeper's status bar. Header kept in an extractedBoardView+AccessibilityHeader.swift(nofile_lengthdisable).Verified:
swift test: SudokuKit 255/255, MinesweeperKit 183/183; no snapshot baseline moved.Minor remaining at AX5: the difficulty label truncates (e.g. "Me") in its narrow slot — VoiceOver label stays full; acceptable polish vs the resolved blank-pad / off-screen-clip bugs.
🤖 Generated with Claude Code