Repository navigation
fix(ui): scale fixed font sizes with Dynamic Type (A11Y007) - #1444
Conversation
Resolves the 38 advisory A11Y007 findings that were not in the baseline. SwiftUI has no Font.system(size:relativeTo:), so add a scaledSystemFont(size:weight:design:relativeTo:) modifier backed by @ScaledMetric: same point size at the default text size, scales like the nearest Apple text style otherwise. Glyphs drawn inside fixed-size badges are capped at xxxLarge so they cannot outgrow the badge. At accessibility sizes the transfer source row moves its balance under the title. The audit now accepts a size held in an @ScaledMetric property (it already scales), and its fix hint no longer suggests the non-existent API. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 37 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
✅ Final review complete — no blockers (commit 7d0424e) · triage: normal |
thepastaclaw
left a comment
There was a problem hiding this comment.
Final validation — Phase 1 + Phase 2
The Dynamic Type replacements and accessibility-size layout changes are consistent with the PR goal, and the accessibility audit and test-target membership checks pass. Two non-blocking issues remain in the audit self-tests and exemption logic; the simulator test is still in progress, while the failed PR-title checks are policy checks rather than code failures.
🟡 2 suggestion(s)
Approved: nothing here blocks the merge. The non-blocking findings are optional: fix them forward, in this PR or a follow-up, without waiting for another review round.
1 finding(s) not shown inline (the lines are not part of this PR's diff)
🟡 Suggestion: Use supported Dynamic Type paths in the A11Y007 self-tests
scripts/a11y_audit.py:1056-1057
The new A11Y007 behavior is not covered by the fixture list. The only non-finding fixture currently uses .system(size: ..., relativeTo: ...), but SwiftUI does not provide that overload, so the fixture is not compilable and does not exercise either supported path introduced by this PR. Replace it with an @ScaledMetric-backed size fixture and add a scaledSystemFont fixture so the documented exemptions are protected against regression.
("A11Y007", False,
'@ScaledMetric(relativeTo: .body) var scaledSize: CGFloat = 15\n'
'Text(x).font(.system(size: scaledSize))\n'),
("A11Y007", False,
'Text(x).scaledSystemFont(size: 15, relativeTo: .body)\n'),
source: muse-spark-1.3-contributor (phase1-reviewer: general); gpt-6.1-sol (phase2-reviewer: general)
Review provenance
Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: general); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
normalbygpt-6.1-sol(effort low) — This is a cross-cutting UI and accessibility tooling change affecting 38 SwiftUI call sites and layout behavior at accessibility sizes, but it does not modify a critical surface such as funds movement, cryptography, key handling, or storage. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer - Phase 1 model:
muse-spark-1.3-contributor— not quota-gated; passed overgemini-3.8-flash-high(antigravity quota lookup failed),glm-5.3-flash(not used above high effort; tier asks max) - Second Phase-2 pass: on this first full review every Phase-2 reviewer also ran a second, independent time, and the verifier weighed both sets
- Fresh verifier:
gpt-6.1-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— general (completed, effort high); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.
In `scripts/a11y_audit.py`:
- [SUGGESTION] scripts/a11y_audit.py:1056-1057: Use supported Dynamic Type paths in the A11Y007 self-tests
The new A11Y007 behavior is not covered by the fixture list. The only non-finding fixture currently uses `.system(size: ..., relativeTo: ...)`, but SwiftUI does not provide that overload, so the fixture is not compilable and does not exercise either supported path introduced by this PR. Replace it with an `@ScaledMetric`-backed size fixture and add a `scaledSystemFont` fixture so the documented exemptions are protected against regression.
- [SUGGESTION] scripts/a11y_audit.py:724-727: Scope the @ScaledMetric exemption to the matching declaration
The exemption searches the entire Swift file for an `@ScaledMetric` property with the same identifier as the `.system(size:)` argument. A file can therefore contain one view with `@ScaledMetric var size` and another view with an ordinary `let size`, while the latter fixed-size font is incorrectly skipped. Scope the lookup to the declaration/use that owns the argument, or use a parser that can distinguish Swift scopes, and add a self-test with same-named scaled and unscaled properties in separate scopes.
| # A size held in an @ScaledMetric property already follows Dynamic Type. | ||
| size_arg = re.match(r"\.system\s*\(\s*size\s*:\s*([A-Za-z_][A-Za-z0-9_]*)\s*[,)]", args + ")") | ||
| if size_arg and re.search( | ||
| r"@ScaledMetric\b[^\n]*\bvar\s+{}\b".format(re.escape(size_arg.group(1))), code): |
There was a problem hiding this comment.
🟡 Suggestion: Scope the @ScaledMetric exemption to the matching declaration
The exemption searches the entire Swift file for an @ScaledMetric property with the same identifier as the .system(size:) argument. A file can therefore contain one view with @ScaledMetric var size and another view with an ordinary let size, while the latter fixed-size font is incorrectly skipped. Scope the lookup to the declaration/use that owns the argument, or use a parser that can distinguish Swift scopes, and add a self-test with same-named scaled and unscaled properties in separate scopes.
source: gpt-6.1-sol (phase2-reviewer: general)
Summary
Fixes the 38 advisory A11Y007 (Dynamic Type) findings that
scripts/a11y_audit.py --checkprinted because they are not inscripts/a11y_baseline.json. They were not added to the baseline, and the baseline was not regenerated.scaledSystemFont(size:weight:design:relativeTo:)inFont+DWStyle.swift. SwiftUI has noFont.system(size:relativeTo:)(it fails to compile), so this wraps@ScaledMetric: the exact point size at the default text size, scaling like the nearest Apple text style otherwise (11→caption2, 12→caption, 13→footnote, 14/15→subheadline, 16→callout, 18→body, 20→title3, 34→largeTitle).xxxLargetext size so they can't outgrow the circle.@ScaledMetricproperty already scales, so the rule no longer flags it (this was a false positive atAppConnectApproveSheet.swift:426). The fix hint no longer suggests the API that doesn't exist.ACCESSIBILITY.mdis updated to match.Default text size is unchanged: before and after renders at the default size are byte-identical for every component captured below.
Screenshots (largest accessibility text size, AX5)
Rendered off-screen with
ImageRenderer. Covered: transfer source rows with preview and validation note, Shielded transfer steps, coin-consolidation sheet, last-sync label.Not captured: the CoinJoin move-funds sheet (the renderer can't draw
ScrollViewcontent), and the Notifications, Send-to-contact card, Shielded recovery, SPV status and Connect sheets (they need wallet, contact or Platform state).Test plan
scripts/a11y_audit.py --check: no A11Y007 findings, no new blocking findingsdashpayscheme builds (xcodebuild … -scheme dashpay … ARCHS=arm64 build)🤖 Generated with Claude Code