Skip to content

a11y: Dynamic Type support for Compact Widget metric tiles#2123

Closed
bruschill wants to merge 1 commit into
meshtastic:mainfrom
bruschill:a11y/pr8-dynamic-type
Closed

a11y: Dynamic Type support for Compact Widget metric tiles#2123
bruschill wants to merge 1 commit into
meshtastic:mainfrom
bruschill:a11y/pr8-dynamic-type

Conversation

@bruschill

@bruschill bruschill commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

What changed?

Adds Dynamic Type support to the node-detail Compact Widget metric tiles, whose large numeric readouts used hardcoded .font(.system(size: N)) (30–72pt) that ignored the user's text-size setting and would clip inside fixed-height tiles.

  • Large numeric readouts → @ScaledMetric(relativeTo: .largeTitle) private var valueSize…: CGFloat = N + .font(.system(size: valueSize)), so the font scales with Dynamic Type. Base values equal the prior hardcoded sizes → pixel-parity at the default size.
  • Added .lineLimit(1) + .minimumScaleFactor(0.5) so enlarged text scales-to-fit the uniform grid tile instead of clipping (grid-row alignment preserved).
  • Small unit labels .font(.system(size: 14)) → semantic .font(.footnote).
  • Decorative glyphs (aqi.medium SF Symbol, verbatim symbol) left untouched.
  • 10 files changed, +71 / −18 (Compact Widgets + PowerMetrics.swift).

Why did it change?

Users who increase their system text size (or use Accessibility larger text) saw these sensor readouts stay fixed-size and, at large settings, clip. Making them scale respects Dynamic Type while keeping the tile grid aligned.

How is this tested?

Built the Meshtastic scheme for iOS Simulator (iPhone 17 Pro, Xcode 26) → ** BUILD SUCCEEDED **. SwiftLint clean. Passed a focused Swift/SwiftUI review (ship-it) confirming the @ScaledMetric usage/anchor is correct and does not fight minimumScaleFactor, default-size parity holds, the glyph-vs-text split is right, and there are no caller/layout regressions in PowerMetrics.swift/SoilCompactWidgets.swift. Verify visually via Settings → Accessibility → Display & Text Size → Larger Text.

Screenshots/Videos (when applicable)

dyntype_comparison

Checklist

  • My code adheres to the project's coding and style guidelines.
  • I have conducted a self-review of my code.
  • I have commented my code, particularly in complex areas.
  • I have verified whether these changes require updates to the in-app documentation under docs/user/ or docs/developer/. No doc update is needed (presentational Dynamic Type change under Views/Helpers/, no behavior/flow change) — please apply the skip-docs-check label.
  • I have tested the change to ensure that it works as intended.

Summary by CodeRabbit

  • Improvements
    • Compact metric widgets now adapt numeric text sizes to the device’s Dynamic Type settings.
    • Long distance, pressure, rainfall, wind, power, soil, weather, particulate matter, radiation, and weight values fit more reliably on a single line.
    • Values can scale down automatically when space is limited, improving readability in compact layouts.
    • Measurement unit labels now use standard footnote styling for more consistent typography.

@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Compact metric widgets now use Dynamic Type–scaled numeric fonts. Several widgets use footnote unit styling, while numeric displays add single-line constraints and minimum scale factors where needed.

Changes

Compact widget typography scaling

Layer / File(s) Summary
Dynamic Type metrics for compact widgets
Meshtastic/Views/Helpers/Compact Widgets/*
Distance, particulate matter, pressure, radiation, rainfall, soil, weather, and weight widgets define scaled numeric font metrics.
Scaled value and unit rendering
Meshtastic/Views/Helpers/Compact Widgets/*
Numeric values use the new metrics; applicable unit labels use .footnote.
Single-line compact layout handling
Meshtastic/Views/Helpers/Compact Widgets/WindCompactWidget.swift, Meshtastic/Views/Helpers/PowerMetrics.swift
Wind, current, and voltage values use scaled fonts with single-line limits and minimum scale factors.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: garthvh

Poem

I’m a rabbit with fonts that grow,
Scaling softly row by row.
Tiny units hop to footnote space,
Long values shrink with graceful grace.
Dynamic type makes widgets bright—
Ears up for compact text done right!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main change: adding Dynamic Type support to compact widget metric tiles.
Description check ✅ Passed The description matches the template with clear What/Why/How tested, screenshots, and a completed checklist.

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

Comment @coderabbitai help to get the list of available commands.

@bruschill

Copy link
Copy Markdown
Contributor Author

Closing this one. The change makes the Compact Widget readouts respond to Dynamic Type, but the tiles have fixed dimensions (maxWidth 150, maxHeight 140), so minimumScaleFactor immediately shrinks the scaled font back to fit and the net user-visible effect at accessibility text sizes is negligible — while the surrounding labels still truncate.

A genuinely meaningful fix requires relaxing the fixed tile dimensions so content isn't clipped/truncated at large text sizes, which is a larger layout change (it affects the tile grid everywhere these widgets render) and out of scope for this accessibility-annotation pass. Deferring to a dedicated follow-up rather than merging a marginal change.

@bruschill bruschill closed this Jul 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-docs-check Use this label to skip the automatic docs audit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant