Commit 6106896950

61068969503c320b1b2e02f58ebbd8f0f59d04ae

parent: 02a3463eed

Unsigned

cmc <hello@cleberg.net> · 2026-10-26 07:40 UTC

Stop Form pickers clipping their value at accessibility text sizes (!53)

A `Picker` in a `Form` renders as a menu button: the label takes the width it
needs and the value gets what is left, on one line. At `AccessibilityXXXL` on an
iPhone 16 that leaves nothing. Measured on Monitoring Settings:

| Row | Value | Rendered |
| --- | --- | --- |
| Base Interval | Every 12 Hours | `E…rs` |
| Notify For | Critical + Warnings | `C…s` |
| Domains | All Tracked | `A…d` |

`AdaptivePicker` switches to `.pickerStyle(.navigationLink)` when
`dynamicTypeSize.isAccessibilitySize` — the value goes on its own line under a
full-width label — and stays a menu below that, so the interaction is unchanged
for anyone not using accessibility text. It replaces the eight `Picker`s on
History & Network and Monitoring Settings.

Two other treatments were measured and rejected: `fixedSize`, which the menu
button ignores, and stacking the label above the menu, where the value still
truncates (`Criti…nings`) because the menu holds it to one line.

## Enforcement

`textClipped` on Monitoring Settings: 5 → 0 on the floor tier, 0 on the
current tier. It becomes the first Settings destination to gate rather than
report. `audit()` takes an `enforcing:` set for that, so a screen part-way
through its burndown gates on the categories it has cleared instead of waiting
for the whole screen.

History & Network keeps one clipped finding — its own navigation title, 17
characters, which only a shorter screen name would fix.

## What is not fixed

The `dynamicType` findings on these rows are unchanged and stay reported. They
are reproducible, but probe rows of the same constructs (`Text`, `Toggle`,
`LabeledContent`) audit clean in the same `Form`, inserting rows above moves
which labels are named, and the rows render correctly at every size up to
`AccessibilityXXXL`. No fix follows from them, and a suppression broad enough
to cover them would hide real regressions.

## Found on the way, not from this change

`testSettingsScreen` — an enforced test — fails on iOS 27.0 with three
`[FAIL][dynamicType]` findings on the Settings root rows. Reproduced with this
change stashed, on `main` at `02a3463`. The floor tier passes, the pre-push
hook runs the floor tier only, and there is no CI, so nothing has been looking
at the current tier. Recorded in `Docs/ACCESSIBILITY.txt`; it needs a decision
rather than a quiet carve-out.

Ref #21

Layout: unified · split

Docs/ACCESSIBILITY.txt +119 −35
@@ -137,6 +137,11 @@ Three deliberate carve-outs, each with its evidence:
137137 clipped/dynamic-type artifacts. Nothing disappears silently; see
138138 `noiseReason(for:)` for each rule's provenance.
139139
140`enforcedAuditTypes` is what a fully cleared screen gets. A screen part-way
141through its burndown passes `enforcing:` to `audit` instead, naming only the
142categories it has cleared, so progress gates as it is made rather than waiting
143on the whole screen. Monitoring Settings is the first: `.textClipped` only.
144
140145Enforcement is a committed constant rather than a CI setting, for two reasons.
141146Environment variables do not work: neither a plain `xcodebuild` env var nor a
142147`TEST_RUNNER_`-prefixed build setting reaches the UI test process, so the toggle
@@ -196,6 +201,120 @@ settings forms with the most rows.
196201App Info is the inverse: 17 findings, 2 real, the rest system-field and
197202unattributed artefacts already characterised in `noiseReason(for:)`.
198203
204The counts above are the floor tier (iPhone 16, iOS 18.6). The current tier
205reports fewer on every screen — Monitoring Settings 13 against 8, App Info 17
206against 5 — which is the asymmetry the coverage table below already records,
207measured here across ten more screens.
208
209## Menu pickers clip their value at accessibility text sizes
210
211A `Picker` in a `Form` renders as a menu button: the label takes the width it
212needs and the value gets what is left, on one line. At `AccessibilityXXXL` on
213an iPhone 16 that leaves nothing. Measured on Monitoring Settings before the
214fix:
215
216| Row | Value | Rendered |
217| --- | --- | --- |
218| Base Interval | Every 12 Hours | `E…rs` |
219| Notify For | Critical + Warnings | `C…s` |
220| Domains | All Tracked | `A…d` |
221| Sensitivity | Medium | `Medium` |
222
223Three treatments were measured. Only the third works:
224
225- **`.fixedSize(horizontal: false, vertical: true)`** — no change. The menu
226 button ignores it.
227- **Stacking the label above the menu** in a `VStack` at accessibility sizes —
228 the label gets full width, but the value still truncates
229 (`Criti…nings`). The menu's value is one line whatever width it gets.
230- **`.pickerStyle(.navigationLink)`** — the row becomes label over value with a
231 chevron, both in full, and the options move to a pushed list. This is what
232 iOS Settings itself does at these sizes.
233
234`AdaptivePicker` (`DomainDigUI.swift`) applies the third only when
235`dynamicTypeSize.isAccessibilitySize`, and stays a menu below that, so the
236interaction is unchanged for anyone not using accessibility text. It replaces
237the eight `Picker`s on History & Network and Monitoring Settings, the two
238quiet-hours pickers among them — those render only while the toggle is on, so
239the audit has never seen them, but they are the same construct.
240
241Result on the floor tier: `textClipped` on Monitoring Settings goes from 5 to
2420, and on History & Network from 3 to 1. Both screens are clipping-free on the
243current tier. Monitoring Settings is therefore the first Settings destination
244to gate rather than report, on `.textClipped` alone — the `enforcing:` argument
245on `AccessibilityAuditHarness.audit` is the ratchet at screen granularity, and
246it passes on both tiers.
247
248The same clipping is still reported on Display ("Compact", "Default",
249"System") and iCloud Sync ("Merge"), which are the same construct on screens
250outside this pass.
251
252## The remaining `dynamicType` findings on Form rows are unexplained
253
254Every `Picker`, `Toggle` and `LabeledContent` label on these two screens
255reports `dynamicType` "font sizes are partially unsupported", and the picker
256fix above does not change that. Eight on Monitoring Settings, five named on
257History & Network, the same names on both runtimes.
258
259They are reproducible — identical on the floor and current tiers, and
260identical across repeat runs — but nothing was found that distinguishes a row
261that reports from one that does not:
262
263- **The same constructs report nothing.** `Text`, `Text` with the density
264 caption font, `Toggle` and `LabeledContent` inserted as probe rows into the
265 same `Form` all audit clean.
266- **Inserting rows moves the findings.** With five probe rows above them,
267 "Adaptive Monitoring" began reporting and "Enable Background Monitoring"
268 stopped, and "Background Refresh" and "Notification Access" switched from
269 `dynamicType` to `contrast`. An element's font scalability does not change
270 because rows were inserted above it, so whatever the check measures depends
271 on where the row sits, not on the row.
272- **The rows render correctly.** Captured at `XXL` and `AccessibilityXXXL`:
273 every named label scales, wraps and reads in full. Nothing is truncated and
274 nothing stops growing.
275
276So the finding does not point at a defect in the label it names, and no fix
277follows from it. They stay reported rather than suppressed: a `noiseReason`
278rule broad enough to cover them would also hide a real regression on any Form
279row. `dynamicType` is not enforced on these screens.
280
281## The Settings root fails the enforced audit on the current runtime
282
283Found while measuring the above, and **not caused by it** — reproduced with the
284change stashed, on `main` at `02a3463`:
285
286```
287settings: 7 finding(s)
288 • [FAIL][dynamicType] ... — "Local API"
289 • [FAIL][dynamicType] ... — "Monitoring Settings"
290 • [FAIL][dynamicType] ... — "iCloud Sync"
291```
292
293`testSettingsScreen` is an enforced test, and this fails it on iOS 27.0. The
294floor tier passes. The pre-push hook runs the floor tier only and there is no
295CI, so nothing has been looking at the current tier since the hook was wired
296up.
297
298The three are the same unexplained finding as above: all twelve rows in the
299Settings root are an identical `NavigationLink("Title") { … }`, the three named
300are consecutive middle rows, and the set is the same on repeat runs. It needs a
301decision — suppress, or widen the hook to both tiers and accept a red gate —
302rather than a quiet carve-out.
303
304## Long navigation titles clip
305
306`textClipped` is reported against the navigation title of exactly the screens
307whose title is 15 characters or more: History & Network, Scheduled Reports,
308Import & Export, Data Management. The short ones — Display, Monitoring, Local
309API, iCloud Sync — are clean. The large title renders in full at default size;
310it is the growth at larger sizes that does not fit, and SwiftUI does not wrap a
311large title.
312
313The only remedy in app code is a shorter title, which for these four would mean
314naming the screen something other than what the Settings row that opens it
315says. Left as reported. It is the one `textClipped` finding still open on
316History & Network, and why that screen stays report-only.
317
199318## Recent searches are never audited
200319
201320The empty-state suite launches a fresh install, so Inspect's recent-searches
@@ -242,41 +361,6 @@ Measured: the same full `xcodebuild test` that reported one enforced failure
242361reports none, `AccessibilityAuditTests` goes from 13 of 14 passing to 14, and
243362`tracked-domains` is back to a single characterised-noise finding.
244363
245## Recent searches are never audited
246
247The empty-state suite launches a fresh install, so Inspect's recent-searches
248section — which only appears once a lookup has been run — is never in the tree
249when the audit walks it. Driving one real lookup and re-auditing surfaced four
250findings in it on iOS 27.0:
251
252- `dynamicType` on the "RECENT" header and on the "Clear" button
253- `hitRegion` too small on "Clear"
254- `sufficientElementDescription`, "label not human-readable", on a domain chip
255
256These are latent rather than new: nothing in the section changed when Inspect
257moved to a `List`. They need a seeded recent-searches fixture to be audited
258properly, which the seed harness does not have.
259
260## The empty-state screens are not reliably empty
261
262`AccessibilityAuditHarness.launch` only adds launch arguments; it never resets
263the app's store. A `seeded: true` test therefore leaves its fixtures behind, and
264any later non-seeded launch audits a populated app rather than an empty one.
265
266Measured: `testTrackedDomainsScreen` reports 1 finding and passes against a
267clean store, and 6 findings — including an enforced
268`[FAIL][dynamicType]` on `EditButton` — when a seeded test has run before it in
269the same invocation. Nothing about the screen changed between the two.
270
271So the enforced suite's result depends on execution order, which means the
272pre-push hook can report a failure that a re-run on a fresh simulator does not.
273When a `[FAIL]` appears, check it against a clean store before believing it.
274
275Fixing it properly means the harness resetting the app's store between
276launches — a launch argument that wipes the suite's `UserDefaults` domain
277would do it, and would also let the recent-searches section below be audited on
278purpose rather than by accident.
279
280364## Why the floor runtime needs its own run
281365
282366**Audit coverage is not nested across OS versions.** Each runtime reports
DomainDig/DomainDigUI.swift +41
@@ -100,6 +100,47 @@ enum AppDensity: String, CaseIterable, Identifiable {
100100 }
101101}
102102
103/// A `Form` picker that moves its options to a pushed list at accessibility text
104/// sizes and stays a menu below them.
105///
106/// A menu picker gives its value whatever horizontal space the label does not
107/// use, and holds it to one line. At `AccessibilityXXXL` on an iPhone 16 that
108/// leaves "Every 12 Hours" rendering as "E…rs" and "Critical + Warnings" as
109/// "C…s" — the audit's `textClipped` findings on Monitoring Settings and
110/// History & Network. The pushed list puts the value on its own line under a
111/// full-width label.
112///
113/// Stacking the label above the menu was measured and does not fix it: the
114/// menu's value is one line whatever width it gets ("Criti…nings"). Neither
115/// does `fixedSize`, which the menu button ignores.
116struct AdaptivePicker<Value: Hashable, Options: View>: View {
117 private let title: String
118 private let selection: Binding<Value>
119 private let options: Options
120
121 @Environment(\.dynamicTypeSize) private var dynamicTypeSize
122
123 init(_ title: String, selection: Binding<Value>, @ViewBuilder options: () -> Options) {
124 self.title = title
125 self.selection = selection
126 self.options = options()
127 }
128
129 var body: some View {
130 if dynamicTypeSize.isAccessibilitySize {
131 picker.pickerStyle(.navigationLink)
132 } else {
133 picker.pickerStyle(.menu)
134 }
135 }
136
137 private var picker: some View {
138 Picker(title, selection: selection) {
139 options
140 }
141 }
142}
143
103144/// Layout constants that are not density-dependent.
104145enum AppLayout {
105146 /// The HIG minimum for an interactive control, and WCAG 2.5.8's floor.
DomainDig/SettingsViews.swift +8 −8
@@ -175,7 +175,7 @@ private struct HistoryNetworkSettingsView: View {
175175 var body: some View {
176176 Form {
177177 Section("History") {
178 Picker(
178 AdaptivePicker(
179179 "Auto-prune",
180180 selection: Binding(
181181 get: { viewModel.historyAutoPruneOption },
@@ -193,7 +193,7 @@ private struct HistoryNetworkSettingsView: View {
193193 }
194194
195195 Section("Network") {
196 Picker("Resolver", selection: $resolverOption) {
196 AdaptivePicker("Resolver", selection: $resolverOption) {
197197 ForEach(DNSResolverOption.allCases) { option in
198198 Text(option.title).tag(option)
199199 }
@@ -212,7 +212,7 @@ private struct HistoryNetworkSettingsView: View {
212212 }
213213 }
214214
215 Picker("Lookup profile", selection: $storedProfile) {
215 AdaptivePicker("Lookup profile", selection: $storedProfile) {
216216 ForEach(InspectionProfile.allCases) { profile in
217217 Text(profile.title).tag(profile.rawValue)
218218 }
@@ -471,7 +471,7 @@ private struct MonitoringSettingsView: View {
471471 )
472472 )
473473
474 Picker(
474 AdaptivePicker(
475475 "Base Interval",
476476 selection: Binding(
477477 get: { MonitoringBaseInterval.nearest(to: viewModel.monitoringSettings.baseInterval) },
@@ -491,7 +491,7 @@ private struct MonitoringSettingsView: View {
491491 )
492492 )
493493
494 Picker(
494 AdaptivePicker(
495495 "Sensitivity",
496496 selection: Binding(
497497 get: { viewModel.monitoringSettings.sensitivity },
@@ -530,7 +530,7 @@ private struct MonitoringSettingsView: View {
530530 ))
531531 }
532532
533 Picker(
533 AdaptivePicker(
534534 "Domains",
535535 selection: Binding(
536536 get: { viewModel.monitoringSettings.scope },
@@ -570,7 +570,7 @@ private struct MonitoringSettingsView: View {
570570 )
571571 )
572572
573 Picker(
573 AdaptivePicker(
574574 "Notify For",
575575 selection: Binding(
576576 get: { viewModel.monitoringSettings.alertFilter },
@@ -608,7 +608,7 @@ private struct MonitoringSettingsView: View {
608608 }
609609
610610 private func hourPicker(_ title: String, selection: Binding<Int>) -> some View {
611 Picker(title, selection: selection) {
611 AdaptivePicker(title, selection: selection) {
612612 ForEach(0..<24, id: \.self) { hour in
613613 Text(Self.monitoringHourLabel(for: hour)).tag(hour)
614614 }
DomainDigUITests/AccessibilityAuditHarness.swift +8 −2
@@ -88,12 +88,18 @@ enum AccessibilityAuditHarness {
8888 /// unattributed contrast/dynamicType failures on rows that measure 6–7:1
8989 /// and render correctly. Until that behaves, the seeded screens report
9090 /// their burndown without gating CI.
91 ///
92 /// `enforcing` narrows the enforced set for one screen, so a screen whose
93 /// burndown is partly clear can gate on the categories it has cleared
94 /// while still reporting the rest. That is the ratchet at screen
95 /// granularity: `enforcedAuditTypes` is what a cleared screen gets.
9196 @discardableResult
9297 static func audit(
9398 _ app: XCUIApplication,
9499 screen: String,
95100 test: XCTestCase,
96 reportOnly: Bool = false
101 reportOnly: Bool = false,
102 enforcing: XCUIAccessibilityAuditType = enforcedAuditTypes
97103 ) throws -> Bool {
98104 var findings: [String] = []
99105 var timeout: Error?
@@ -125,7 +131,7 @@ enum AccessibilityAuditHarness {
125131 return true
126132 }
127133
128 let isEnforced = !reportOnly && !enforcedAuditTypes.intersection(issue.auditType).isEmpty
134 let isEnforced = !reportOnly && !enforcing.intersection(issue.auditType).isEmpty
129135 let marker = isEnforced ? "FAIL" : "report"
130136 findings.append("[\(marker)][\(name(for: issue.auditType))] \(issue.compactDescription) — \(element)")
131137 // true suppresses the finding, false reports it as a test failure.
DomainDigUITests/AccessibilityAuditTests.swift +20 −2
@@ -258,7 +258,14 @@ final class AccessibilityAuditTests: XCTestCase {
258258 /// Report-only for the same reason as Integrations: they have never been
259259 /// through the ratchet, so gating them on first contact would fail the
260260 /// build on findings that predate the coverage. They are a burndown list
261 /// for #21, and `enforcedAuditTypes` widens once they are clear.
261 /// for #21, and the enforced set widens per screen as each one clears.
262 ///
263 /// Monitoring Settings is the first to gate, on `.textClipped` alone: its
264 /// five clipped picker values are fixed (`AdaptivePicker`) and that
265 /// category is now empty on both runtimes. Its `dynamicType` findings stay
266 /// reported — they are reproducible but nothing was found that
267 /// distinguishes a row that reports from one that does not, and the rows
268 /// render correctly at every size. See `Docs/ACCESSIBILITY.txt`.
262269 ///
263270 /// One launch rather than ten: re-selecting the Settings tab pops it back
264271 /// to root, so each destination is reached from a known place, and the
@@ -276,6 +283,9 @@ final class AccessibilityAuditTests: XCTestCase {
276283 "Data Management",
277284 "App Info"
278285 ]
286 let enforcedPerScreen: [String: XCUIAccessibilityAuditType] = [
287 "Monitoring Settings": .textClipped
288 ]
279289
280290 let app = AccessibilityAuditHarness.launch()
281291 var unreachable: [String] = []
@@ -296,7 +306,15 @@ final class AccessibilityAuditTests: XCTestCase {
296306 .lowercased()
297307 .replacingOccurrences(of: " & ", with: "-")
298308 .replacingOccurrences(of: " ", with: "-")
299 if try !AccessibilityAuditHarness.audit(app, screen: screen, test: self, reportOnly: true) {
309 let enforced = enforcedPerScreen[destination]
310 let audited = try AccessibilityAuditHarness.audit(
311 app,
312 screen: screen,
313 test: self,
314 reportOnly: enforced == nil,
315 enforcing: enforced ?? []
316 )
317 if !audited {
300318 unaudited.append(destination)
301319 }
302320 }