Docs/ACCESSIBILITY.txt

732 lines · 39121 bytes

  1# Accessibility Audit
  2
  3`DomainDigUITests` runs Apple's `performAccessibilityAudit()` across every
  4primary screen. The audit checks contrast, hit-region size, clipped text at
  5large Dynamic Type, element descriptions, trait correctness, and Dynamic Type
  6support — the same ground the accessibility pass tracked in
  7[issue #21](https://github.com/krazywarez/domain-dig/issues/21) covers.
  8
  9## The colour palette
 10
 11Semantic colours live in `Shared/Colors.xcassets`, which is inside the `Shared`
 12file-system-synchronized group and therefore reaches the app, the widget, and
 13the share extension automatically. `AccentColor` stays in
 14`DomainDig/Assets.xcassets` because it is the system-wide tint resolved via
 15`ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME`.
 16
 17Use the generated asset symbols — `Color(.statusCritical)`, `Color(.appSurface)`
 18— never a literal. `ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS`
 19is on, so these are compile-time checked; a typo will not build.
 20
 21Every value clears WCAG AA (4.5:1) as text on its page, on its card, **and on
 22its own 16% badge tint** — the way `AppStatusBadgeView` actually draws it. The
 23worst of those three is shown:
 24
 25| Role | Light | Dark | Worst light | Worst dark |
 26| --- | --- | --- | --- | --- |
 27| `StatusInfo` / `AccentColor` | `#0000FF` | `#4DA3FF` | 6.76 | 6.47 |
 28| `StatusPositive` | `#008035` | `#30D158` | 4.54 | 7.62 |
 29| `StatusWarning` | `#AD5100` | `#FF9F0A` | 4.59 | 7.76 |
 30| `StatusCritical` | `#CC0700` | `#FF6961` | 4.68 | 6.12 |
 31| `StatusNeutral` | `#5A5A5F` | `#A1A1A6` | 5.84 | 6.76 |
 32
 33Each status foreground has a matching `…Surface` colour for the fill behind it,
 34paired through `AppStatusTone`.
 35
 36**That table is enforced, not just recorded.** `PaletteContrastTests` reads the
 37colorsets, computes WCAG relative luminance, and asserts every status
 38foreground clears 4.5:1 on the page, on a card, and on its own badge fill, in
 39light and dark — the three surfaces `AppStatusBadgeView` can draw it on. It
 40covers `AppTextSecondary` on all three surfaces too, and `AppOnAccent` on
 41`StatusInfo`, which is the selected Dashboard chip. Until it existed, the
 42harness called this palette "the actual guard against contrast regressions"
 43while nothing checked it.
 44
 45One pairing is deliberately not asserted. `AppOnAccent` over `AccentFill`
 46measures **2.78:1** in dark — black on `#0040DD` — but nothing draws it:
 47`accentFill` goes to `.tint`, where iOS picks its own label colour, and the
 48accent themes override `.onAccent` to white against their own fill. The number
 49is noted in the test so anything that starts drawing that pair has it to hand.
 50
 51### Contrast alone is not a palette
 52
 53The first version of this palette maximised contrast and produced mud. Requiring
 54every foreground to clear 4.5:1 against *its own 16% tint* — the harshest
 55surface it ever sits on — pushed each colour ~20% darker than the common case
 56needed. `#7A5600` is not amber, it is olive; `#146C2E` is not green so much as
 57bottle-dark. Contrast passed and the UI was still hard to read, because hue
 58identity is what tells "warning" from "critical" at a glance.
 59
 60Two fixes:
 61
 621. **Decouple the fill from the foreground.** `AppStatusTone` carries a
 63   `foreground` and a `surface` that are authored independently, so the
 64   foreground no longer has to survive a wash of itself. Every status foreground
 65   is now fully saturated (`S = 1.0`).
 662. **Warning is orange, not yellow.** Yellow cannot stay yellow at a lightness
 67   low enough to clear 4.5:1 on white — it *becomes* olive. That is
 68   colorimetric, not a tuning problem. Orange holds its identity when darkened,
 69   so warning is `#AD5100` in light and `#FF9F0A` in dark.
 70
 71When adding a colour, search for the most saturated value that passes, not the
 72darkest. The darkest is always easy and always wrong.
 73| `AppTextSecondary` | `#5A5A5F` | `#A1A1A6` | 6.15 | 7.50 |
 74
 75`AppTextSecondary` replaces `.secondary` for body text. iOS's own `secondaryLabel`
 76is only **3.29:1** on a light card — below AA — which never showed while the app
 77was locked to dark, where the same colour reads 6.32:1. Unlocking light mode
 78exposed it across 191 sites.
 79
 80High Contrast variants push further in the same direction. Surfaces
 81(`AppBackground`, `AppSurface`, `AppSurfaceElevated`, `AppSeparator`) carry no
 82meaning, so they get Any/Dark and, where useful, High Contrast — but no status
 83semantics.
 84
 85Why custom values instead of the system palette: **every** system colour fails
 86in light mode. Measured on white — systemYellow 1.51:1, systemOrange 2.20:1,
 87systemGreen 2.22:1, systemCyan 2.54:1, systemRed 3.55:1. All of them pass in
 88dark mode, which is why the dark-locked app looked fine and why unlocking light
 89mode is impossible without this work.
 90
 91### The accent has two roles, and they conflict
 92
 93An accent used as **text on a dark background** must be light. The same accent
 94used as a **fill behind a white label** must be dark. One value cannot do both:
 95`#4DA3FF` reads at 8.00:1 as text on black, but only 2.63:1 behind white text.
 96
 97So there are two colours:
 98
 99- `StatusInfo` / `AccentColor` — the accent as *foreground*: text, icons,
100  bordered-button labels, tab bar.
101- `AccentFill` — the accent as a *filled background* behind a label, used by
102  `.borderedProminent`. Stays dark in both schemes so a white label clears AA
103  (8.59:1 light, 7.56:1 dark).
104
105`AppOnAccent` is the label colour for a solid accent fill and flips by scheme —
106white on the light accent, black on the dark one.
107
108## Appearance
109
110`AppAppearance` (System / Light / Dark) is stored in `@AppStorage` and applied in
111**exactly one place** — the `WindowGroup` in `DomainDigApp`. Keep it that way. The
112app previously carried 16 separate `.preferredColorScheme(.dark)` calls scattered
113through view bodies, which is how light mode became unreachable without anyone
114noticing; re-applying per view is what let the lock spread.
115
116Users override it under Settings → Display.
117
118### Known light-mode findings
119
120| Finding | Cause | Action |
121| --- | --- | --- |
122| 2× `contrast failed` on Settings | The last rows of a section sit under the translucent tab bar, so the audit measures text against a blended background. Present in dark mode too, since phase 0. | None — standard iOS scroll-under behaviour |
123| 3× `contrast nearly passed` on Settings | iOS-rendered `Section` headers (`TIER`, `PREFERENCES`, `SERVICES`) use the system's grey. | Not fixed. Overriding system header styling across every section to gain ~0.3:1 on decorative labels trades platform convention for very little |
124
125Dark mode reports 18 findings and light mode 21; the three extra are the section
126headers above. Everything the app actually controls passes in both schemes.
127
128## Enforcement — the ratchet is engaged
129
130With phases 1–5 landed, `AccessibilityAuditHarness.enforcedAuditTypes` enforces
131**`.textClipped`, `.dynamicType`, `.hitRegion`, `.elementDetection`,
132`.sufficientElementDescription`, `.trait`** on the empty-state test suite. A
133named finding in any of these fails the test run — regressions in five phases of
134work are still gated locally and at the pre-push hook, not merely reported.
135
136Three deliberate carve-outs, each with its evidence:
137
1381. **`.contrast` stays report-only.** The two long-standing Settings findings
139   are rows scrolled under the translucent tab bar; their attribution flips
140   between a row name and nil run-to-run, so no suppression is narrow enough to
141   keep CI stable. The centralised palette in `Shared/Colors.xcassets` is the
142   actual guard against contrast regressions. The same tab bar degrades
143   `dynamicType` on the rows immediately above it, which is a separate carve-out
144   — see "`dynamicType` findings land on a position, not on a row".
1452. **The seeded tests run `reportOnly`.** Bisecting the row/badge accessibility
146   modifiers showed the audit degrades on `children: .ignore` content — the
147   *correct* VoiceOver treatment for dense rows — emitting unattributed
148   contrast/dynamicType failures on rows that measure 6–7:1 and render
149   correctly. Their burndown still prints; it just doesn't gate.
1503. **Characterised noise is suppressed narrowly and always logged** with a
151   `[noise: reason]` marker — disabled controls (WCAG 1.4.3 exempt), "nearly
152   passed" near-misses, system field placeholders (clipped at any length —
153   proven by shortening them to no effect), and unattributed
154   clipped/dynamic-type artifacts. Nothing disappears silently; see
155   `noiseReason(for:)` for each rule's provenance.
156
157`enforcedAuditTypes` is what a fully cleared screen gets. A screen part-way
158through its burndown passes `enforcing:` to `audit` instead, naming only the
159categories it has cleared, so progress gates as it is made rather than waiting
160on the whole screen. Monitoring Settings and Display gate on `.textClipped`.
161
162Enforcement is a committed constant rather than a CI setting, for two reasons.
163Environment variables do not work: neither a plain `xcodebuild` env var nor a
164`TEST_RUNNER_`-prefixed build setting reaches the UI test process, so the toggle
165silently did nothing. And a committed value makes "when did clipping become
166enforced?" answerable with `git blame` instead of CI tribal knowledge.
167
168## Screens reached through Settings
169
170The suite audited the five root tabs and the watchlist only, so every screen
171behind a Settings row was unaudited — including the integration editor's whole
172form, which is the densest set of text fields and captions in the app, and the
173SMTP port caption added in !5, which had never been rendered at the largest
174Dynamic Type under audit (A-review C9).
175
176Integrations and the integration editor are now covered, **report-only**: they
177have never been through the ratchet, so gating them on first contact would fail
178the build on findings that predate the coverage. What they report on iOS 27.0:
179
180| Screen | Findings |
181| --- | --- |
182| Integrations | 1: `dynamicType` on "Process Queue Now" |
183| Integration editor | 7: `contrast` on "Cancel", "Save", "DNS Changed", "Routing Rules"; `dynamicType` on "Cancel" and "Save"; one characterised system-field-placeholder clip |
184
185That table is the iOS 27.0 reading from !42. The editor's clipped picker values
186were fixed later — see the picker section below — and its `contrast` and
187`dynamicType` attribution churns between runs, so treat the names as indicative
188rather than a checklist.
189
190"Cancel" and "Save" are the editor's toolbar buttons, plain `Button`s with no
191density-aware font, which is why they appear in both categories. Note that for
192`dynamicType` that is **not** the cause — see "Already-scalable fonts report
193too" below — so only the `contrast` half of their findings is a real question.
194`enforcedAuditTypes` widens to cover these screens once they are clear.
195
196The other ten destinations are covered by `testSettingsDestinations`, also
197report-only. One launch audits all of them: re-selecting the Settings tab pops
198it back to root, so each row is tapped from a known place, and the store reset
199makes the launch state the same for every one. That is 98s for ten screens
200rather than ten launches.
201
202All ten are reachable and all ten audit. 87 findings, of which 43 are real and
20344 are already-characterised noise. **No enforced failures**, which is why the
204test passes report-only rather than needing a carve-out:
205
206| Screen | Real | Noise |
207| --- | --- | --- |
208| Monitoring Settings | 12 | 1 |
209| History & Network | 7 | 5 |
210| Scheduled Reports | 5 | 1 |
211| Monitoring Log | 4 | 1 |
212| Import & Export | 4 | 5 |
213| Display | 3 | 1 |
214| Local API | 3 | 5 |
215| Data Management | 2 | 8 |
216| App Info | 2 | 15 |
217| iCloud Sync | 1 | 2 |
218
219By category the 43 are: `dynamicType` 21, `textClipped` 15, `contrast` 6,
220`elementDetection` 1. Read that breakdown with the reclassification below: the
221`dynamicType` column turned out not to be a list of defects, so "43 real"
222overstates what is actually left to fix.
223
224App Info is the inverse: 17 findings, 2 real, the rest system-field and
225unattributed artefacts already characterised in `noiseReason(for:)`.
226
227The counts above are the floor tier (iPhone 16, iOS 18.6). The current tier
228reports fewer on every screen — Monitoring Settings 13 against 8, App Info 17
229against 5 — which is the asymmetry the coverage table below already records,
230measured here across ten more screens.
231
232## Menu pickers clip their value at accessibility text sizes
233
234A `Picker` in a `Form` renders as a menu button: the label takes the width it
235needs and the value gets what is left, on one line. At `AccessibilityXXXL` on
236an iPhone 16 that leaves nothing. Measured on Monitoring Settings before the
237fix:
238
239| Row | Value | Rendered |
240| --- | --- | --- |
241| Base Interval | Every 12 Hours | `E…rs` |
242| Notify For | Critical + Warnings | `C…s` |
243| Domains | All Tracked | `A…d` |
244| Sensitivity | Medium | `Medium` |
245
246Three treatments were measured. Only the third works:
247
248- **`.fixedSize(horizontal: false, vertical: true)`** — no change. The menu
249  button ignores it.
250- **Stacking the label above the menu** in a `VStack` at accessibility sizes —
251  the label gets full width, but the value still truncates
252  (`Criti…nings`). The menu's value is one line whatever width it gets.
253- **`.pickerStyle(.navigationLink)`** — the row becomes label over value with a
254  chevron, both in full, and the options move to a pushed list. This is what
255  iOS Settings itself does at these sizes.
256
257`AdaptivePicker` (`DomainDigUI.swift`) applies the third only when
258`dynamicTypeSize.isAccessibilitySize`, and stays a menu below that, so the
259interaction is unchanged for anyone not using accessibility text. It replaces
260the eight `Picker`s on History & Network and Monitoring Settings, the two
261quiet-hours pickers among them — those render only while the toggle is on, so
262the audit has never seen them, but they are the same construct.
263
264Result on the floor tier: `textClipped` on Monitoring Settings goes from 5 to
2650, and on History & Network from 3 to 1. Both screens are clipping-free on the
266current tier. Monitoring Settings is therefore the first Settings destination
267to gate rather than report, on `.textClipped` alone — the `enforcing:` argument
268on `AccessibilityAuditHarness.audit` is the ratchet at screen granularity, and
269it passes on both tiers.
270
271The same clipping is still reported on Display ("Compact", "Default",
272"System") and iCloud Sync ("Merge"), which are the same construct on screens
273outside this pass.
274
275## `dynamicType` findings land on a position, not on a row
276
277The remaining `dynamicType` findings — eight on Monitoring Settings, five named
278on History & Network, three on the Settings root — report "font sizes are
279partially unsupported" against rows the app sets no font on. They are
280reproducible: identical on both runtimes and across repeat runs. The picker fix
281above does not touch them.
282
283**They follow the slot, not the row.** Reordering the Settings root's Services
284section moves the findings onto whichever rows take the vacated positions:
285
286| Slot | Before | | After | |
287| --- | --- | --- | --- | --- |
288| 1 | Monitoring Log | | Local API | |
289| 2 | Integrations | | iCloud Sync | |
290| 3 | Local API | FAIL | Monitoring Settings | FAIL |
291| 4 | iCloud Sync | FAIL | Monitoring Log | FAIL |
292| 5 | Monitoring Settings | FAIL | Integrations | FAIL |
293| 6 | Scheduled Reports | contrast | Scheduled Reports | contrast |
294
295Every one of those rows is an identical `NavigationLink("Title") { … }`. The
296only thing that changed is which title sits in slots 3–5.
297
298**The slots are the band above the tab bar.** Measured frames at default size
299in a 912pt window:
300
301| Row | y | Hittable |
302| --- | --- | --- |
303| Monitoring Log | 590–642 | yes |
304| Integrations | 642–694 | yes |
305| Local API | 694–746 | yes |
306| iCloud Sync | 746–798 | yes |
307| Monitoring Settings | 798–850 | yes |
308| Scheduled Reports | 850–902 | **no** |
309
310The translucent tab bar starts around y 829. The three reporting slots are the
311156pt directly above it; the row that sits fully behind it reports `contrast`
312instead. As the audit sweeps content size categories the rows march downward —
313at `XXXL`, Monitoring Settings is at y 885 and no longer hittable and
314Scheduled Reports is gone from the tree entirely — so the rows in that band are
315the ones whose measurement degrades part-way through the sweep. Hence
316"partially".
317
318This is the same root cause already carved out for `.contrast`: rows under the
319translucent tab bar. It simply surfaces in a second audit category.
320
321Two earlier observations fit this and no other explanation:
322
323- **The same constructs report nothing.** `Text`, `Text` with the density
324  caption font, `Toggle` and `LabeledContent` inserted as probe rows into the
325  Monitoring Settings `Form` all audit clean — they sat near the top.
326- **Inserting rows moved the findings.** With five probe rows above them,
327  "Adaptive Monitoring" began reporting and "Enable Background Monitoring"
328  stopped, and "Background Refresh" and "Notification Access" switched from
329  `dynamicType` to `contrast` — pushed from the band into the bar.
330- **The rows render correctly.** Captured at `XXL` and `AccessibilityXXXL`,
331  every named label scales, wraps and reads in full.
332
333### Confirmed across the rest of the burndown
334
335The Settings root is not a special case. Reordering two more screens moves the
336verdict off the labels that had it and onto the labels that take their place.
337
338**Monitoring Settings** — "Notify For", "Background Refresh" and "Notification
339Access" moved from the bottom of the section to the top. Eight findings before,
340eight after, and five of the names changed:
341
342| Row | Before | After |
343| --- | --- | --- |
344| Background Refresh | reports | **clean** (moved to slot 2) |
345| Notification Access | reports | **clean** (moved to slot 3) |
346| Enable Background Monitoring | clean | **reports** (pushed to slot 4) |
347| Adaptive Monitoring | clean | **reports** (pushed to slot 6) |
348| Base Interval, Sensitivity, Quiet Hours, Domains, Local Alerts, Notify For | reports | reports |
349
350**History & Network** — the History and Network sections swapped. "Allow
351third-party enrichment" stopped reporting when its section moved to the top;
352five findings became four, with no change to that toggle.
353
354Nothing about any of those labels changed — not the text, not the font, not the
355construct. Four of them flipped verdict in each direction purely by moving.
356
357### Already-scalable fonts report too
358
359`EmptyStateCardView` sets `appDensity.font(...)` on its title, message and
360suggestion — `Font.system(textStyle:)`, scalable by construction — and applies
361`.fixedSize(horizontal: false, vertical: true)` so each one wraps and grows.
362All three still report `dynamicType` on Scheduled Reports and Monitoring Log.
363
364That rules out the obvious reading of these findings, which is that the named
365text uses a non-scaling font. **Earlier notes in this file and in the issue
366suggested the integration editor's plain `Button("Cancel")` / `Button("Save")`
367report `dynamicType` because they lack a density-aware font, and that adding one
368is a two-line fix. That is not supported.** Text that already has a
369density-aware font reports just the same.
370
371### What this means for the #21 burndown
372
373The `dynamicType` column is not a list of defects, so the 43 "real" findings in
374the Settings table above overstate what is left:
375
376| Category | Count | Status |
377| --- | --- | --- |
378| `dynamicType` | 21 | Not actionable — position-dependent, per the above |
379| `textClipped` | 15 | 7 fixed by `AdaptivePicker`; 4 are long navigation titles; **4 remain** |
380| `contrast` | 6 | Report-only; the palette is tested instead |
381| `elementDetection` | 1 | Unattributed — see below |
382
383The actionable remainder was four clipped picker values — "Compact", "Default"
384and "System" on Display, and "Merge" on Import & Export — the same construct
385`AdaptivePicker` already fixes. (An earlier note put "Merge" on iCloud Sync;
386that was read off a sorted list pooled across screens. iCloud Sync has no
387clipped findings at all.)
388
389All four are now fixed, by converting the three Display pickers and the Import
390Mode picker. `textClipped` on Display goes from 3 to 0, so it joins Monitoring
391Settings in gating on that category. Import & Export keeps one clipped finding —
392its own navigation title — so it stays report-only despite its picker being
393fixed.
394
395That leaves, across the ten Settings destinations:
396
397| Finding | Where | Why it stays |
398| --- | --- | --- |
399| 4 clipped navigation titles | History & Network, Scheduled Reports, Import & Export, Data Management | Only a shorter screen name fixes it |
400| 21 `dynamicType` | all | Position-dependent, per the above |
401| 6 `contrast` | all | Report-only; the palette is tested instead |
402| 1 `elementDetection` | Local API | Unattributed — see below |
403
404`AdaptivePicker` also reached the integration editor's three pickers — Type,
405Minimum Severity and SMTP Security. Its clipped findings go from four to one:
406"Warning" and "Webhook" cleared, and "Minimum Severity" cleared too, though
407that one had already shown itself unstable — it reported on a single-test run
408of the editor and not on the full-suite run of the same build.
409
410The editor is **not** gated on `.textClipped` even so. "Add Integration" is a
41115-character navigation title, the same unfixable case as the four Settings
412destinations, and a screen with one finding that comes and goes between runs is
413not a screen to gate.
414
415### What was done about it
416
417The Settings root is the only *enforced* screen long enough to reach the band,
418so it was the only one failing — `testSettingsScreen`, on iOS 27.0, with three
419`[FAIL][dynamicType]` findings. Reproduced with the picker change stashed on
420`main` at `02a3463`, so it predated that work. The floor tier passes, the
421pre-push hook runs the floor tier only, and there is no CI, which is why
422nothing had been looking at it.
423
424`noiseReason` now classifies dynamicType findings on the Settings root's row
425titles (`settingsDestinationRows`), with the reorder table recorded inline as
426the evidence. It is scoped to that category and those titles, so a regression on
427anything else on that screen still fails.
428
429Not done, deliberately: nothing was changed in the UI. List content scrolling
430under a translucent tab bar is how iOS is supposed to look, and inset-ing the
431list to stop it would be changing correct layout to satisfy a measurement
432artifact.
433
434The equivalent findings on the report-only Settings destinations are the same
435artifact and stay reported — those screens do not gate, so there is nothing to
436unblock, and a suppression wide enough to cover arbitrary `Form` rows would
437hide real regressions.
438
439## `contrast` and `elementDetection`, the last two categories
440
441Neither is a to-do list either, for different reasons.
442
443**Every `elementDetection` finding is unattributed.** Across both runtimes they
444report against "unknown element" — on `seeded-dashboard`,
445`seeded-tracked-domains` and `monitoring-log`, and nowhere else. All three are
446report-only screens, so none of them gates anything, and a finding that names no
447element cannot be acted on. No carve-out was added: there is nothing to unblock,
448and a rule wide enough to cover them would weaken an enforced category
449everywhere else.
450
451**The `contrast` attribution differs so much between runtimes that the names
452cannot be worked through.** On `seeded-tracked-domains` the floor names 25
453elements and the current runtime names 5, largely a different set; on
454`seeded-dashboard` the floor reports 4 unattributed findings and the current
455runtime names 17. Same build, same fixtures. That is the flip the `.contrast`
456carve-out was written for, at a larger scale.
457
458What was done instead is the thing the carve-out always pointed at: the palette
459is tested, so a colour that stops clearing AA fails the unit suite in seconds
460rather than appearing as one more unstable name in an audit list.
461
462## Long navigation titles clip
463
464`textClipped` is reported against the navigation title of exactly the screens
465whose title is 15 characters or more: History & Network, Scheduled Reports,
466Import & Export, Data Management. The short ones — Display, Monitoring, Local
467API, iCloud Sync — are clean. The large title renders in full at default size;
468it is the growth at larger sizes that does not fit, and SwiftUI does not wrap a
469large title.
470
471The only remedy in app code is a shorter title, which for these four would mean
472naming the screen something other than what the Settings row that opens it
473says. Left as reported. It is the one `textClipped` finding still open on
474History & Network, and why that screen stays report-only.
475
476## Recent searches
477
478Inspect's recent-searches section appears only once a lookup has been run, so
479the empty-state suite never had it in the tree. Four findings in it were found
480by accident, by driving one real lookup; `testSeededRecentSearches` now covers
481it on purpose.
482
483**It needs its own launch argument.** `DOMAIN_DIG_SEED_FIXTURES` cannot be used:
484Inspect renders either a result or the recent list, never both, so seeding the
485batch results takes the branch and the section never appears. The first attempt
486did exactly that and audited the batch screen instead — 35 findings, all of them
487already covered by `testSeededBatchResults`. `DOMAIN_DIG_SEED_RECENT` seeds
488`recentSearches` alone. Assigning that property does not persist (only
489`addRecentSearch` and `clearRecentSearches` write to defaults), so it leaks no
490more than the other fixtures.
491
492The test asserts "RECENT" is on screen before auditing. Without that it passes
493while measuring the wrong thing, which is how the first attempt looked green
494until the finding list was read.
495
496Under audit, the section reported eight findings. Two kinds were real:
497
498- **`hitRegion` on "Clear".** A `Button("Clear")` with a `.caption2` font and no
499  padding is about 16pt tall, well under the WCAG 2.5.8 floor. Given
500  `minWidth`/`minHeight` of `AppLayout.minimumTapTarget` and a
501  `contentShape(Rectangle())`.
502- **`sufficientElementDescription` on each domain chip.** The button's label was
503  the bare domain, which reads as neither a word nor an action. Given
504  `accessibilityLabel("Look up <domain>")`; "Clear" likewise got "Clear recent
505  searches".
506
507Eight findings became three: two characterised noise entries, and `dynamicType`
508on the "RECENT" header. `dynamicType` on "Clear" cleared as a side effect of the
50944pt frame, which is consistent with those findings tracking geometry rather
510than the element.
511
512So the section gates on everything the project enforces except `.dynamicType` —
513`enforcedAuditTypes.subtracting(.dynamicType)`. It is the only seeded screen
514that gates at all.
515
516## The empty-state screens are cleared before each launch
517
518The enforced suite audits several screens in their empty state, and nothing used
519to guarantee they were empty: `AccessibilityAuditHarness.launch` only added
520launch arguments, so whatever a previous run, a manual launch or another test
521target had left in the app's container was still there.
522
523That made the result depend on what ran before it. `testTrackedDomainsScreen`
524passed with one finding in isolation, and reported six — including an enforced
525`[FAIL][dynamicType]` on `EditButton`, which only renders when the watchlist has
526rows — during a full `xcodebuild test`, which is what the pre-push hook runs.
527
528**A correction to what this file said first.** The initial note blamed the
529seeded fixtures. That was wrong: `seedAuditFixturesIfRequested` writes only to
530the live view model and `auditFixturesActive` blocks persistence precisely so
531they cannot leak, and running the whole audit class against a cleared store
532reproduces neither the failure nor the extra findings. Ruled out as well: the
533unit target, which leaves `trackedDomains` as an empty array in the app's own
534defaults.
535
536**The source of the rows was never isolated, and the search is closed.** The
537remaining plan was to instrument a full-suite run, dump `trackedDomains` at each
538launch and bisect which test precedes contamination. That is not being done: the
539reset below makes the question unobservable from the suite's results, so the
540answer would change nothing. Reopen it only if a finding shows up that the reset
541does not explain.
542
543What fixed it is making the question moot. `AuditFixtures.resetStoreIfRequested`
544clears the app's defaults domain and the history files when
545`DOMAIN_DIG_RESET_STORE` is passed, and the harness passes it on every launch.
546It runs as the view model's `defaults:` argument rather than inside `init()`,
547because a property's default value is evaluated before the initialiser body —
548a reset in the body would run after the first read.
549
550Measured: the same full `xcodebuild test` that reported one enforced failure
551reports none, `AccessibilityAuditTests` goes from 13 of 14 passing to 14, and
552`tracked-domains` is back to a single characterised-noise finding.
553
554## Why the floor runtime needs its own run
555
556**Audit coverage is not nested across OS versions.** Each runtime reports
557findings the others miss, in *both* directions. Measured on this project:
558
559| Screen | iOS 18.6 | iOS 27.0 |
560| --- | --- | --- |
561| Tracked Domains | 2 (text clipped) | **6** (+ contrast ×3, element detection) |
562| Settings | 2 contrast | **`dynamicType`** finding 18.6 missed |
563| Dashboard @ `AccessibilityXXXL` | **hit region** + 2 clipped | 1 clipped only |
564
565Neither runtime is a superset, so the oldest supported OS needs its own run.
566This also rules out committing per-screen baseline counts as a regression guard:
567no single number is correct on both.
568
569The audit therefore runs locally, across both ends, via
570`Scripts/audit-a11y.sh` — on a machine that actually has an 18.x runtime
571installed. The pre-push hook in `.githooks/` runs both of them.
572
573There is no CI job. The GitHub Actions workflow that used to run this suite on
574the newest runtime has been removed, and with it the one check that no local run
575can reproduce: **a clean checkout of the merge result.** That mattered here
576because `DomainDig.xcodeproj` is hand-edited and uses file-system-synchronized
577groups, where a whole missing folder still builds fine locally and breaks only
578for someone else. A local hook runs against the working tree, so it cannot catch
579a file that was never committed. Nothing covers that now — verify a fresh clone
580by hand before a release.
581
582## Running it
583
584```sh
585./Scripts/audit-a11y.sh            # floor + current (~20 min)
586./Scripts/audit-a11y.sh floor      # oldest supported only (~8 min)
587./Scripts/audit-a11y.sh current    # newest installed only (~10 min)
588```
589
590It exits non-zero when a tier fails — an enforced category reporting a named
591finding, or the suite not running at all — so it can be used as a gate. Findings
592in unenforced categories are printed and do not affect the exit code.
593
594The script reads the deployment target from the project rather than hard-coding
595it, and selects the oldest installed runtime **at or above** it — a runtime
596below the deployment target is useless, because the app cannot install there.
597If the nearest installed runtime is a major version above the target, it says
598so rather than implying floor coverage it does not have.
599
600### Pre-push hook
601
602```sh
603git config core.hooksPath .githooks
604```
605
606Runs the complexity ratchet, then the audit on **both** runtimes, before a push,
607and only when Swift, asset, or project files changed. Bypass with
608`git push --no-verify`.
609
610Both tiers rather than the floor alone because coverage is not nested across OS
611versions (below) and there is no CI, so a tier the hook does not run is not run
612at all. The cost is real: about twenty minutes, against roughly eight for the
613floor alone.
614
615Pre-push rather than pre-commit deliberately: at pre-commit that blocks every
616commit. A hook routinely bypassed with `--no-verify` is worse than no hook,
617because it trains you to ignore it — which is the standing argument against
618letting this get any slower.
619
620## Layout gotchas found the hard way
621
622- **`Label` clips its own title.** Every empty-state heading reported as clipped
623  text. `.fixedSize` applied to the `Label` does not reach the `Text` inside it,
624  so the fix is to split it into an `HStack { Image; Text }` and put the modifier
625  on the `Text`. Changing the font design did **not** help — that hypothesis was
626  tested and discarded.
627- **Splitting a `Label` exposes its icon to VoiceOver.** `Label` folds the image
628  into the title's accessibility element; an `HStack` does not, so the icon
629  starts announcing its raw SF Symbol name ("checklist.unchecked"). Decorative
630  icons split out of a `Label` need `.accessibilityHidden(true)`.
631- **Placeholder text is always reported as clipped.** Search prompts and
632  `TextField` placeholders are flagged regardless of length — shortening
633  "Search portfolio" to "Search" changed nothing. Treat `textClipped` findings on
634  a `searchField` or `textField` element as noise rather than shortening useful
635  prompts to chase them.
636- **`AppLayout.minimumTapTarget` is the floor for every control.** `@ScaledMetric`
637  scales *down* below the default text size as well as up, so a scaled dimension
638  needs `max(scaled, AppLayout.minimumTapTarget)` or it drops under 44pt for
639  users who prefer smaller text.
640
641## VoiceOver conventions
642
643- **Dense rows use combine-for-summary, custom-content-for-detail.**
644  `BatchResultRowView` and `WatchlistRowView` each hold 8–9 text elements.
645  Reading them inline makes a long sweep unnavigable, so each row is one element:
646  `.accessibilityElement(children: .ignore)` + domain label + status value, with
647  the rest on `.accessibilityCustomContent(...)`. `.high` importance is spoken
648  inline; everything else reaches the More Content rotor on a vertical swipe.
649  Rows with only 3–4 elements (the portfolio activity/attention/expiry rows) are
650  left to `NavigationLink`'s automatic combine — custom content is for the dense
651  case, per WWDC21-10121.
652- **The custom-content chain must live in a `ViewModifier`.** Inlined onto a row
653  body, six `.accessibilityCustomContent` calls plus the visual layout blow the
654  Swift type-checker's budget ("unable to type-check in reasonable time").
655  `BatchRowAccessibility` / `WatchlistRowAccessibility` exist for that reason.
656- **Splitting a `Label` exposes its icon; combining a header swallows its
657  trailing controls.** Two opposite traps. A decorative icon pulled out of a
658  `Label` needs `.accessibilityHidden(true)`. A header built as a `Button` must
659  *not* get `.accessibilityElement(children: .combine)` if its label contains
660  other controls (`CollapsibleSectionView`'s `trailing()` holds Track/Pin) —
661  combine would merge them into the header and make them unreachable.
662- **Label-in-name (WCAG 2.5.3).** Every `accessibilityLabel` added to a control
663  with visible text keeps that text, so Voice Control still works. Free-form
664  labels are used only where the control is genuinely icon-only.
665- **Technical strings** get `speechStyle: .technical` on `InfoRowViewData`, which
666  applies `.speechAlwaysIncludesPunctuation()` and
667  `.accessibilityTextContentType(.sourceCode)`. Set today on DNS record values
668  and cipher suites; extend it wherever the view model emits a fingerprint,
669  serial, or record string.
670
671## Color independence, motion, transparency
672
673- **Status is never colour-only.** In-app badges already pair a symbol with the
674  colour. The widget status dot is now an SF Symbol
675  (`checkmark.circle.fill` / `exclamationmark.triangle.fill` /
676  `exclamationmark.octagon.fill`) — the same vocabulary as the badges, so a
677  status reads consistently across surfaces and survives greyscale.
678- **`accessibilityDifferentiateWithoutColor`** adds redundant shape only when the
679  user asks for it, avoiding clutter otherwise: the Dashboard summary-card dot
680  becomes a per-filter symbol, the selected quick-filter chip gains a checkmark
681  and border (selection was fill-colour only), and `LabeledValueRow` prefixes a
682  warning/failure symbol.
683- **`accessibilityReduceMotion`** guards all five animation sites via
684  `withAnimation(reduceMotion ? nil : …)` / `.animation(reduceMotion ? nil : …)`:
685  `AppCopyButton`'s check cross-fade, `CollapsibleSectionView`'s expand/collapse,
686  `TimelineDiffView`'s scroll, and `WatchlistView`'s list reorder.
687- **`accessibilityReduceTransparency`** swaps the single `.thinMaterial` for an
688  opaque `AppSurfaceElevated` capsule.
689
690These cannot be verified by `simctl`, which toggles only Increase Contrast — the
691other three settings live in the simulator's Settings app. They are correct by
692construction and build-clean; their runtime behaviour is part of the Phase 6
693manual pass. `SweepActivityController` was dropped from the motion list: it is
694pure ActivityKit lifecycle with no animation to guard.
695
696### What the automated audit cannot check
697
698`performAccessibilityAudit()` validates descriptions, traits, contrast, hit
699regions, and clipping. It does **not** exercise VoiceOver speech, the More
700Content rotor, custom-content ordering, or announcements. Those are verified by
701construction and a manual VoiceOver pass (Phase 6), not by the suite. A green
702audit is necessary, not sufficient, for the row and speech work.
703
704Additionally, the dense rows (`BatchResultRowView`, `WatchlistRowView`) and the
705widget never render in the audit — the test simulator has no tracked domains or
706batch results. Their treatment is unverified by the suite for the same reason the
707Phase 3 `ViewThatFits` work was deferred: absence of findings is absence of data.
708
709## Notes
710
711- **Disabled controls are a false positive, and are suppressed.** WCAG 1.4.3
712  exempts inactive components from contrast requirements, but the audit flags
713  them anyway — Inspect's Run button is disabled until a domain is typed, and
714  auditing the empty state reported a contrast failure that was never a real
715  defect. The harness now drops contrast findings whose element reports
716  `isEnabled == false`. Suppressing on the rule beats driving the UI to enable
717  the control: typing raises the keyboard, which then follows the audit onto
718  later screens and flags the system emoji picker's category buttons.
719- **A dirty simulator inflates the burndown.** Keyboard state persists across
720  runs, so a simulator left with the emoji picker open reports ~9 phantom
721  hit-region findings per screen. If findings appear that name system UI
722  ("Flags category", "Frequently Used category"), erase the simulator
723  (`xcrun simctl erase <udid>`) and re-run before believing them.
724- Audits retry up to three times. Slower machines can miss the audit's internal
725  deadline (`Audit failed to complete in time`, code `-56`), which is a tooling
726  timeout, not an app defect. A screen that still cannot be audited is reported
727  as an `XCTSkip`, never a pass — skips are visually distinct in CI, so an
728  unaudited screen stays visible instead of being silently counted as clean.
729- The suite launches with `DOMAIN_DIG_FORCE_PRO_PLUS` so Pro-gated screens are
730  reachable. `PurchaseService` honours that argument in `DEBUG` builds only.
731- Everything used is available at the iOS 17.6 deployment floor;
732  `performAccessibilityAudit` is `ios(17.0)`.