Docs/ACCESSIBILITY.txt
753 lines · 40218 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 floor-only case as the four Settings
412destinations above, and a screen with one finding that comes and goes between
413runs is not 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, on the narrower device only
463
464`textClipped` is reported against the navigation title of exactly the screens
465whose title runs to 15 characters or more:
466
467| Title | Length | Screen |
468| --- | --- | --- |
469| History & Network | 17 | Settings → History & Network |
470| Scheduled Reports | 17 | Settings → Scheduled Reports |
471| Import & Export | 15 | Settings → Import & Export |
472| Data Management | 15 | Settings → Data Management |
473| Add Integration | 15 | the integration editor |
474
475The short ones are clean: Display (7), App Info (8), Settings (8), Local API
476(9), Monitoring (10), iCloud Sync (11).
477
478**All five report on the floor tier only.** iPhone 16 is 393pt wide and iPhone
479Air is 420pt, and the current tier reports none of them, so this is screen
480width rather than OS version — the one entry in the coverage table below that
481the newer runtime misses for a reason that is understood. The large title
482renders in full at default size; it is the growth at larger sizes that does not
483fit, and SwiftUI does not wrap a large title.
484
485The only remedy in app code is a shorter title, which for these five would mean
486naming the screen something other than the row that opens it. Left as reported.
487It is the single `textClipped` finding still open on History & Network, Import
488& Export, Data Management and the integration editor, and why those screens
489stay report-only while Display and Monitoring Settings gate.
490
491## Recent searches
492
493Inspect's recent-searches section appears only once a lookup has been run, so
494the empty-state suite never had it in the tree. Four findings in it were found
495by accident, by driving one real lookup; `testSeededRecentSearches` now covers
496it on purpose.
497
498**It needs its own launch argument.** `DOMAIN_DIG_SEED_FIXTURES` cannot be used:
499Inspect renders either a result or the recent list, never both, so seeding the
500batch results takes the branch and the section never appears. The first attempt
501did exactly that and audited the batch screen instead — 35 findings, all of them
502already covered by `testSeededBatchResults`. `DOMAIN_DIG_SEED_RECENT` seeds
503`recentSearches` alone. Assigning that property does not persist (only
504`addRecentSearch` and `clearRecentSearches` write to defaults), so it leaks no
505more than the other fixtures.
506
507The test asserts "RECENT" is on screen before auditing. Without that it passes
508while measuring the wrong thing, which is how the first attempt looked green
509until the finding list was read.
510
511Under audit, the section reported eight findings. Two kinds were real:
512
513- **`hitRegion` on "Clear".** A `Button("Clear")` with a `.caption2` font and no
514 padding is about 16pt tall, well under the WCAG 2.5.8 floor. Given
515 `minWidth`/`minHeight` of `AppLayout.minimumTapTarget` and a
516 `contentShape(Rectangle())`.
517- **`sufficientElementDescription` on each domain chip.** The button's label was
518 the bare domain, which reads as neither a word nor an action. Given
519 `accessibilityLabel("Look up <domain>")`; "Clear" likewise got "Clear recent
520 searches".
521
522Eight findings became three: two characterised noise entries, and `dynamicType`
523on the "RECENT" header. `dynamicType` on "Clear" cleared as a side effect of the
52444pt frame, which is consistent with those findings tracking geometry rather
525than the element.
526
527So the section gates on everything the project enforces except `.dynamicType` —
528`enforcedAuditTypes.subtracting(.dynamicType)`. It is the only seeded screen
529that gates at all.
530
531## The empty-state screens are cleared before each launch
532
533The enforced suite audits several screens in their empty state, and nothing used
534to guarantee they were empty: `AccessibilityAuditHarness.launch` only added
535launch arguments, so whatever a previous run, a manual launch or another test
536target had left in the app's container was still there.
537
538That made the result depend on what ran before it. `testTrackedDomainsScreen`
539passed with one finding in isolation, and reported six — including an enforced
540`[FAIL][dynamicType]` on `EditButton`, which only renders when the watchlist has
541rows — during a full `xcodebuild test`, which is what `Scripts/audit-a11y.sh` runs.
542
543**A correction to what this file said first.** The initial note blamed the
544seeded fixtures. That was wrong: `seedAuditFixturesIfRequested` writes only to
545the live view model and `auditFixturesActive` blocks persistence precisely so
546they cannot leak, and running the whole audit class against a cleared store
547reproduces neither the failure nor the extra findings. Ruled out as well: the
548unit target, which leaves `trackedDomains` as an empty array in the app's own
549defaults.
550
551**The source of the rows was never isolated, and the search is closed.** The
552remaining plan was to instrument a full-suite run, dump `trackedDomains` at each
553launch and bisect which test precedes contamination. That is not being done: the
554reset below makes the question unobservable from the suite's results, so the
555answer would change nothing. Reopen it only if a finding shows up that the reset
556does not explain.
557
558What fixed it is making the question moot. `AuditFixtures.resetStoreIfRequested`
559clears the app's defaults domain and the history files when
560`DOMAIN_DIG_RESET_STORE` is passed, and the harness passes it on every launch.
561It runs as the view model's `defaults:` argument rather than inside `init()`,
562because a property's default value is evaluated before the initialiser body —
563a reset in the body would run after the first read.
564
565Measured: the same full `xcodebuild test` that reported one enforced failure
566reports none, `AccessibilityAuditTests` goes from 13 of 14 passing to 14, and
567`tracked-domains` is back to a single characterised-noise finding.
568
569## Why the floor runtime needs its own run
570
571**Audit coverage is not nested across OS versions.** Each runtime reports
572findings the others miss, in *both* directions. Measured on this project:
573
574| Screen | iOS 18.6 | iOS 27.0 |
575| --- | --- | --- |
576| Tracked Domains | 2 (text clipped) | **6** (+ contrast ×3, element detection) |
577| Settings | 2 contrast | **`dynamicType`** finding 18.6 missed |
578| Dashboard @ `AccessibilityXXXL` | **hit region** + 2 clipped | 1 clipped only |
579
580Neither runtime is a superset, so the oldest supported OS needs its own run.
581This also rules out committing per-screen baseline counts as a regression guard:
582no single number is correct on both.
583
584The audit therefore runs locally, across both ends, via
585`Scripts/audit-a11y.sh` — on a machine that actually has an 18.x runtime
586installed. The pre-push hook in `.githooks/` refuses a push without a recorded
587pass of both.
588
589There is no CI job. The GitHub Actions workflow that used to run this suite on
590the newest runtime has been removed, and with it the one check that no local run
591can reproduce: **a clean checkout of the merge result.** That mattered here
592because `DomainDig.xcodeproj` is hand-edited and uses file-system-synchronized
593groups, where a whole missing folder still builds fine locally and breaks only
594for someone else. A local hook runs against the working tree, so it cannot catch
595a file that was never committed. Nothing covers that now — verify a fresh clone
596by hand before a release.
597
598## Running it
599
600```sh
601./Scripts/audit-a11y.sh # floor + current (~20 min)
602./Scripts/audit-a11y.sh floor # oldest supported only (~8 min)
603./Scripts/audit-a11y.sh current # newest installed only (~10 min)
604```
605
606It exits non-zero when a tier fails — an enforced category reporting a named
607finding, or the suite not running at all — so it can be used as a gate. Findings
608in unenforced categories are printed and do not affect the exit code.
609
610The script reads the deployment target from the project rather than hard-coding
611it, and selects the oldest installed runtime **at or above** it — a runtime
612below the deployment target is useless, because the app cannot install there.
613If the nearest installed runtime is a major version above the target, it says
614so rather than implying floor coverage it does not have.
615
616### Pre-push hook
617
618```sh
619git config core.hooksPath .githooks
620```
621
622Runs the complexity ratchet, then refuses the push unless the tree being pushed
623has a recorded audit pass, when Swift, asset, or project files changed. Bypass
624with `git push --no-verify`.
625
626Run the audit before pushing. `./Scripts/audit-a11y.sh` with no argument, on a
627tree with no tracked changes and no untracked Swift, asset or project files,
628appends `HEAD^{tree}` to `a11y-audit-passed` in the common git dir when both
629tiers pass. A squash or rebase that keeps the tree keeps the pass.
630
631The hook does not run the suite itself because git opens the connection before
632pre-push runs, and gitbay kills a push that moves no data for a minute or has
633not reached pre-receive fifteen minutes after taking its slot. The suite takes
634about twenty minutes, so every push it gated failed.
635
636Both tiers rather than the floor alone because coverage is not nested across OS
637versions (below) and there is no CI, so a tier that is not run is not run at
638all. The cost is real: about twenty minutes, against roughly eight for the floor
639alone.
640
641## Layout gotchas found the hard way
642
643- **`Label` clips its own title.** Every empty-state heading reported as clipped
644 text. `.fixedSize` applied to the `Label` does not reach the `Text` inside it,
645 so the fix is to split it into an `HStack { Image; Text }` and put the modifier
646 on the `Text`. Changing the font design did **not** help — that hypothesis was
647 tested and discarded.
648- **Splitting a `Label` exposes its icon to VoiceOver.** `Label` folds the image
649 into the title's accessibility element; an `HStack` does not, so the icon
650 starts announcing its raw SF Symbol name ("checklist.unchecked"). Decorative
651 icons split out of a `Label` need `.accessibilityHidden(true)`.
652- **Placeholder text is always reported as clipped.** Search prompts and
653 `TextField` placeholders are flagged regardless of length — shortening
654 "Search portfolio" to "Search" changed nothing. Treat `textClipped` findings on
655 a `searchField` or `textField` element as noise rather than shortening useful
656 prompts to chase them.
657- **`AppLayout.minimumTapTarget` is the floor for every control.** `@ScaledMetric`
658 scales *down* below the default text size as well as up, so a scaled dimension
659 needs `max(scaled, AppLayout.minimumTapTarget)` or it drops under 44pt for
660 users who prefer smaller text.
661
662## VoiceOver conventions
663
664- **Dense rows use combine-for-summary, custom-content-for-detail.**
665 `BatchResultRowView` and `WatchlistRowView` each hold 8–9 text elements.
666 Reading them inline makes a long sweep unnavigable, so each row is one element:
667 `.accessibilityElement(children: .ignore)` + domain label + status value, with
668 the rest on `.accessibilityCustomContent(...)`. `.high` importance is spoken
669 inline; everything else reaches the More Content rotor on a vertical swipe.
670 Rows with only 3–4 elements (the portfolio activity/attention/expiry rows) are
671 left to `NavigationLink`'s automatic combine — custom content is for the dense
672 case, per WWDC21-10121.
673- **The custom-content chain must live in a `ViewModifier`.** Inlined onto a row
674 body, six `.accessibilityCustomContent` calls plus the visual layout blow the
675 Swift type-checker's budget ("unable to type-check in reasonable time").
676 `BatchRowAccessibility` / `WatchlistRowAccessibility` exist for that reason.
677- **Splitting a `Label` exposes its icon; combining a header swallows its
678 trailing controls.** Two opposite traps. A decorative icon pulled out of a
679 `Label` needs `.accessibilityHidden(true)`. A header built as a `Button` must
680 *not* get `.accessibilityElement(children: .combine)` if its label contains
681 other controls (`CollapsibleSectionView`'s `trailing()` holds Track/Pin) —
682 combine would merge them into the header and make them unreachable.
683- **Label-in-name (WCAG 2.5.3).** Every `accessibilityLabel` added to a control
684 with visible text keeps that text, so Voice Control still works. Free-form
685 labels are used only where the control is genuinely icon-only.
686- **Technical strings** get `speechStyle: .technical` on `InfoRowViewData`, which
687 applies `.speechAlwaysIncludesPunctuation()` and
688 `.accessibilityTextContentType(.sourceCode)`. Set today on DNS record values
689 and cipher suites; extend it wherever the view model emits a fingerprint,
690 serial, or record string.
691
692## Color independence, motion, transparency
693
694- **Status is never colour-only.** In-app badges already pair a symbol with the
695 colour. The widget status dot is now an SF Symbol
696 (`checkmark.circle.fill` / `exclamationmark.triangle.fill` /
697 `exclamationmark.octagon.fill`) — the same vocabulary as the badges, so a
698 status reads consistently across surfaces and survives greyscale.
699- **`accessibilityDifferentiateWithoutColor`** adds redundant shape only when the
700 user asks for it, avoiding clutter otherwise: the Dashboard summary-card dot
701 becomes a per-filter symbol, the selected quick-filter chip gains a checkmark
702 and border (selection was fill-colour only), and `LabeledValueRow` prefixes a
703 warning/failure symbol.
704- **`accessibilityReduceMotion`** guards all five animation sites via
705 `withAnimation(reduceMotion ? nil : …)` / `.animation(reduceMotion ? nil : …)`:
706 `AppCopyButton`'s check cross-fade, `CollapsibleSectionView`'s expand/collapse,
707 `TimelineDiffView`'s scroll, and `WatchlistView`'s list reorder.
708- **`accessibilityReduceTransparency`** swaps the single `.thinMaterial` for an
709 opaque `AppSurfaceElevated` capsule.
710
711These cannot be verified by `simctl`, which toggles only Increase Contrast — the
712other three settings live in the simulator's Settings app. They are correct by
713construction and build-clean; their runtime behaviour is part of the Phase 6
714manual pass. `SweepActivityController` was dropped from the motion list: it is
715pure ActivityKit lifecycle with no animation to guard.
716
717### What the automated audit cannot check
718
719`performAccessibilityAudit()` validates descriptions, traits, contrast, hit
720regions, and clipping. It does **not** exercise VoiceOver speech, the More
721Content rotor, custom-content ordering, or announcements. Those are verified by
722construction and a manual VoiceOver pass (Phase 6), not by the suite. A green
723audit is necessary, not sufficient, for the row and speech work.
724
725Additionally, the dense rows (`BatchResultRowView`, `WatchlistRowView`) and the
726widget never render in the audit — the test simulator has no tracked domains or
727batch results. Their treatment is unverified by the suite for the same reason the
728Phase 3 `ViewThatFits` work was deferred: absence of findings is absence of data.
729
730## Notes
731
732- **Disabled controls are a false positive, and are suppressed.** WCAG 1.4.3
733 exempts inactive components from contrast requirements, but the audit flags
734 them anyway — Inspect's Run button is disabled until a domain is typed, and
735 auditing the empty state reported a contrast failure that was never a real
736 defect. The harness now drops contrast findings whose element reports
737 `isEnabled == false`. Suppressing on the rule beats driving the UI to enable
738 the control: typing raises the keyboard, which then follows the audit onto
739 later screens and flags the system emoji picker's category buttons.
740- **A dirty simulator inflates the burndown.** Keyboard state persists across
741 runs, so a simulator left with the emoji picker open reports ~9 phantom
742 hit-region findings per screen. If findings appear that name system UI
743 ("Flags category", "Frequently Used category"), erase the simulator
744 (`xcrun simctl erase <udid>`) and re-run before believing them.
745- Audits retry up to three times. Slower machines can miss the audit's internal
746 deadline (`Audit failed to complete in time`, code `-56`), which is a tooling
747 timeout, not an app defect. A screen that still cannot be audited is reported
748 as an `XCTSkip`, never a pass — skips are visually distinct in CI, so an
749 unaudited screen stays visible instead of being silently counted as clean.
750- The suite launches with `DOMAIN_DIG_FORCE_PRO_PLUS` so Pro-gated screens are
751 reachable. `PurchaseService` honours that argument in `DEBUG` builds only.
752- Everything used is available at the iOS 17.6 deployment floor;
753 `performAccessibilityAudit` is `ios(17.0)`.