Skip to content

fix(ui): scale fixed font sizes with Dynamic Type (A11Y007) - #1444

Merged
ross-dash merged 1 commit into
developfrom
fix/a11y007-dynamic-type
Nov 19, 2026
Merged

ross-dash merged 1 commit into
developfrom
fix/a11y007-dynamic-type

Conversation

@ross-dash

@ross-dash ross-dash commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes the 38 advisory A11Y007 (Dynamic Type) findings that scripts/a11y_audit.py --check printed because they are not in scripts/a11y_baseline.json. They were not added to the baseline, and the baseline was not regenerated.

  • New modifier scaledSystemFont(size:weight:design:relativeTo:) in Font+DWStyle.swift. SwiftUI has no Font.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).
  • All 38 call sites now use it. Four glyphs drawn inside fixed-size circles are capped at xxxLarge text size so they can't outgrow the circle.
  • Transfer source row: at accessibility text sizes, the balance moves under the title. Otherwise the title broke onto one letter per line.
  • Audit: a size stored in an @ScaledMetric property already scales, so the rule no longer flags it (this was a false positive at AppConnectApproveSheet.swift:426). The fix hint no longer suggests the API that doesn't exist. ACCESSIBILITY.md is 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)

compare-core-coin-consolidation compare-last-sync compare-shielded-steps compare-transfer-source-rows

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 ScrollView content), 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 findings
  • dashpay scheme builds (xcodebuild … -scheme dashpay … ARCHS=arm64 build)
  • Check the changed screens at a large accessibility text size on device

🤖 Generated with Claude Code

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]>
@coderabbitai

coderabbitai Bot commented Nov 17, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c1d136f8-fb15-4878-9868-fd02fc013b8d
Commits

Reviewing files that changed from the base of the PR and between b2f0069 and 7d0424e.

Files selected for processing: 16

  • ACCESSIBILITY.md
  • DashWallet/Sources/UI/DashConnect/AppConnectApproveSheet.swift
  • DashWallet/Sources/UI/DashConnect/Components/ConnectionSheet.swift
  • DashWallet/Sources/UI/DashPay/Contacts/SwiftUI/NotificationsScreen.swift
  • DashWallet/Sources/UI/Home/Views/CoinJoinMoveFunds/CoinJoinMoveFundsSheet.swift
  • DashWallet/Sources/UI/Menu/SyncInfo/LastSyncLabel.swift
  • DashWallet/Sources/UI/Menu/SyncInfo/SwiftDashSDKSPVStatusScreen.swift
  • DashWallet/Sources/UI/Payments/InternalTransfer/Components/TransferAmountValidationNote.swift
  • DashWallet/Sources/UI/Payments/InternalTransfer/Components/TransferPreview.swift
  • DashWallet/Sources/UI/Payments/InternalTransfer/Components/TransferSourceRow.swift
  • DashWallet/Sources/UI/Payments/InternalTransfer/CoreCoinConsolidationSheet.swift
  • DashWallet/Sources/UI/Payments/InternalTransfer/Shielded/ShieldedRecoverySheet.swift
  • DashWallet/Sources/UI/Payments/InternalTransfer/Shielded/ShieldedTransferStepList.swift
  • DashWallet/Sources/UI/Payments/Pay/SendScreen.swift
  • DashWallet/Sources/UI/SwiftUI Components/Font+DWStyle.swift
  • scripts/a11y_audit.py
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@thepastaclaw

thepastaclaw commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

✅ Final review complete — no blockers (commit 7d0424e) · triage: normal

@ross-dash ross-dash changed the title fix(a11y): scale fixed font sizes with Dynamic Type (A11Y007) fix(ui): scale fixed font sizes with Dynamic Type (A11Y007) Nov 17, 2026

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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: normal by gpt-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); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-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; agent sol-verifier
  • Phase 2 reviewers: gpt-6.1-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — general (completed, effort high); agent phase2-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.

Comment thread scripts/a11y_audit.py
Comment on lines +724 to +727
# 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):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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)

@ross-dash
ross-dash merged commit e3e1f19 into develop Nov 19, 2026
8 of 10 checks passed
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.

2 participants