Commit 3b0b8160a3
Unsigned
Layout: unified · split
Docs/ACCESSIBILITY.txt +47 −15
| @@ -435,20 +435,45 @@ naming the screen something other than what the Settings row that opens it | ||
| 435 | 435 | says. Left as reported. It is the one `textClipped` finding still open on |
| 436 | 436 | History & Network, and why that screen stays report-only. |
| 437 | 437 | |
| 438 | ## Recent searches are never audited | |
| 439 | ||
| 440 | The empty-state suite launches a fresh install, so Inspect's recent-searches | |
| 441 | section — which only appears once a lookup has been run — is never in the tree | |
| 442 | when the audit walks it. Driving one real lookup and re-auditing surfaced four | |
| 443 | findings in it on iOS 27.0: | |
| 444 | ||
| 445 | - `dynamicType` on the "RECENT" header and on the "Clear" button | |
| 446 | - `hitRegion` too small on "Clear" | |
| 447 | - `sufficientElementDescription`, "label not human-readable", on a domain chip | |
| 448 | ||
| 449 | These are latent rather than new: nothing in the section changed when Inspect | |
| 450 | moved to a `List`. They need a seeded recent-searches fixture to be audited | |
| 451 | properly, which the seed harness does not have. | |
| 438 | ## Recent searches | |
| 439 | ||
| 440 | Inspect's recent-searches section appears only once a lookup has been run, so | |
| 441 | the empty-state suite never had it in the tree. Four findings in it were found | |
| 442 | by accident, by driving one real lookup; `testSeededRecentSearches` now covers | |
| 443 | it on purpose. | |
| 444 | ||
| 445 | **It needs its own launch argument.** `DOMAIN_DIG_SEED_FIXTURES` cannot be used: | |
| 446 | Inspect renders either a result or the recent list, never both, so seeding the | |
| 447 | batch results takes the branch and the section never appears. The first attempt | |
| 448 | did exactly that and audited the batch screen instead — 35 findings, all of them | |
| 449 | already covered by `testSeededBatchResults`. `DOMAIN_DIG_SEED_RECENT` seeds | |
| 450 | `recentSearches` alone. Assigning that property does not persist (only | |
| 451 | `addRecentSearch` and `clearRecentSearches` write to defaults), so it leaks no | |
| 452 | more than the other fixtures. | |
| 453 | ||
| 454 | The test asserts "RECENT" is on screen before auditing. Without that it passes | |
| 455 | while measuring the wrong thing, which is how the first attempt looked green | |
| 456 | until the finding list was read. | |
| 457 | ||
| 458 | Under audit, the section reported eight findings. Two kinds were real: | |
| 459 | ||
| 460 | - **`hitRegion` on "Clear".** A `Button("Clear")` with a `.caption2` font and no | |
| 461 | padding is about 16pt tall, well under the WCAG 2.5.8 floor. Given | |
| 462 | `minWidth`/`minHeight` of `AppLayout.minimumTapTarget` and a | |
| 463 | `contentShape(Rectangle())`. | |
| 464 | - **`sufficientElementDescription` on each domain chip.** The button's label was | |
| 465 | the bare domain, which reads as neither a word nor an action. Given | |
| 466 | `accessibilityLabel("Look up <domain>")`; "Clear" likewise got "Clear recent | |
| 467 | searches". | |
| 468 | ||
| 469 | Eight findings became three: two characterised noise entries, and `dynamicType` | |
| 470 | on the "RECENT" header. `dynamicType` on "Clear" cleared as a side effect of the | |
| 471 | 44pt frame, which is consistent with those findings tracking geometry rather | |
| 472 | than the element. | |
| 473 | ||
| 474 | So the section gates on everything the project enforces except `.dynamicType` — | |
| 475 | `enforcedAuditTypes.subtracting(.dynamicType)`. It is the only seeded screen | |
| 476 | that gates at all. | |
| 452 | 477 | |
| 453 | 478 | ## The empty-state screens are cleared before each launch |
| 454 | 479 | |
| @@ -468,7 +493,14 @@ the live view model and `auditFixturesActive` blocks persistence precisely so | ||
| 468 | 493 | they cannot leak, and running the whole audit class against a cleared store |
| 469 | 494 | reproduces neither the failure nor the extra findings. Ruled out as well: the |
| 470 | 495 | unit target, which leaves `trackedDomains` as an empty array in the app's own |
| 471 | defaults. The source of the rows was never isolated. | |
| 496 | defaults. | |
| 497 | ||
| 498 | **The source of the rows was never isolated, and the search is closed.** The | |
| 499 | remaining plan was to instrument a full-suite run, dump `trackedDomains` at each | |
| 500 | launch and bisect which test precedes contamination. That is not being done: the | |
| 501 | reset below makes the question unobservable from the suite's results, so the | |
| 502 | answer would change nothing. Reopen it only if a finding shows up that the reset | |
| 503 | does not explain. | |
| 472 | 504 | |
| 473 | 505 | What fixed it is making the question moot. `AuditFixtures.resetStoreIfRequested` |
| 474 | 506 | clears the app's defaults domain and the history files when |
DomainDig/AuditFixtures.swift +20
| @@ -58,6 +58,26 @@ enum AuditFixtures { | ||
| 58 | 58 | /// layout and traits, not string equality, so coverage wins. |
| 59 | 59 | private static let now = Date() |
| 60 | 60 | |
| 61 | /// Inspect's recent-searches section renders only once a lookup has been | |
| 62 | /// run, so a fresh-install audit never sees it. Assigning | |
| 63 | /// `recentSearches` does not persist — only `addRecentSearch` and | |
| 64 | /// `clearRecentSearches` write to defaults — so these stay in memory like | |
| 65 | /// the rest of the fixtures. | |
| 66 | /// | |
| 67 | /// Its own argument rather than part of `DOMAIN_DIG_SEED_FIXTURES`, | |
| 68 | /// because Inspect shows either a result or the recent list, never both: | |
| 69 | /// seeding the batch results takes the branch and the section never | |
| 70 | /// renders. | |
| 71 | static var recentSearches: [String] { | |
| 72 | ["healthy.example", "expiring.example", "broken.example"] | |
| 73 | } | |
| 74 | ||
| 75 | static let recentSearchesArgument = "DOMAIN_DIG_SEED_RECENT" | |
| 76 | ||
| 77 | static var recentSearchesRequested: Bool { | |
| 78 | ProcessInfo.processInfo.arguments.contains(recentSearchesArgument) | |
| 79 | } | |
| 80 | ||
| 61 | 81 | static var trackedDomains: [TrackedDomain] { |
| 62 | 82 | [ |
| 63 | 83 | TrackedDomain( |
DomainDig/ContentView.swift +8
| @@ -589,6 +589,11 @@ struct ContentView: View { | ||
| 589 | 589 | } |
| 590 | 590 | .font(appDensity.font(.caption2)) |
| 591 | 591 | .foregroundStyle(ThemeToken.textSecondary) |
| 592 | // `.caption2` text alone is around 16pt tall, well under the | |
| 593 | // WCAG 2.5.8 floor, which is what the audit reports here. | |
| 594 | .frame(minWidth: AppLayout.minimumTapTarget, minHeight: AppLayout.minimumTapTarget) | |
| 595 | .contentShape(Rectangle()) | |
| 596 | .accessibilityLabel("Clear recent searches") | |
| 592 | 597 | } |
| 593 | 598 | |
| 594 | 599 | ForEach(viewModel.recentSearches, id: \.self) { domain in |
| @@ -606,6 +611,9 @@ struct ContentView: View { | ||
| 606 | 611 | .background(ThemeToken.surface) |
| 607 | 612 | .clipShape(RoundedRectangle(cornerRadius: appDensity.metrics.cardCornerRadius)) |
| 608 | 613 | } |
| 614 | // A bare domain reads as neither a word nor an action; the | |
| 615 | // button re-runs the lookup, so say that. | |
| 616 | .accessibilityLabel("Look up \(domain)") | |
| 609 | 617 | } |
| 610 | 618 | } |
| 611 | 619 | .padding(.top, appDensity.metrics.cardSpacing) |
DomainDig/DomainViewModel.swift +5
| @@ -1793,6 +1793,11 @@ final class DomainViewModel { | ||
| 1793 | 1793 | private(set) var auditFixturesActive = false |
| 1794 | 1794 | |
| 1795 | 1795 | func seedAuditFixturesIfRequested() { |
| 1796 | // Independent of the fixtures below: Inspect renders either a result or | |
| 1797 | // the recent list, so the two cannot be seeded together. | |
| 1798 | if AuditFixtures.recentSearchesRequested { | |
| 1799 | recentSearches = AuditFixtures.recentSearches | |
| 1800 | } | |
| 1796 | 1801 | guard AuditFixtures.requested, !auditFixturesActive else { return } |
| 1797 | 1802 | auditFixturesActive = true |
| 1798 | 1803 | trackedDomains = AuditFixtures.trackedDomains |
DomainDigUITests/AccessibilityAuditHarness.swift +13 −1
| @@ -57,9 +57,18 @@ enum AccessibilityAuditHarness { | ||
| 57 | 57 | /// row treatment went unmeasured. |
| 58 | 58 | private static let seedFixturesArgument = "DOMAIN_DIG_SEED_FIXTURES" |
| 59 | 59 | |
| 60 | /// Matches `AuditFixtures.recentSearchesArgument`. Separate from the | |
| 61 | /// fixtures above because Inspect shows either a result or the recent | |
| 62 | /// list, never both. | |
| 63 | private static let seedRecentSearchesArgument = "DOMAIN_DIG_SEED_RECENT" | |
| 64 | ||
| 60 | 65 | /// Launches the app with feature gating lifted, optionally at a specific |
| 61 | 66 | /// content size category and with the audit fixtures seeded. |
| 62 | static func launch(contentSizeCategory: String? = nil, seeded: Bool = false) -> XCUIApplication { | |
| 67 | static func launch( | |
| 68 | contentSizeCategory: String? = nil, | |
| 69 | seeded: Bool = false, | |
| 70 | recentSearches: Bool = false | |
| 71 | ) -> XCUIApplication { | |
| 63 | 72 | let app = XCUIApplication() |
| 64 | 73 | // Every launch starts from a cleared store, so a screen the enforced |
| 65 | 74 | // suite audits as empty is empty whatever ran before it. |
| @@ -67,6 +76,9 @@ enum AccessibilityAuditHarness { | ||
| 67 | 76 | if seeded { |
| 68 | 77 | app.launchArguments.append(seedFixturesArgument) |
| 69 | 78 | } |
| 79 | if recentSearches { | |
| 80 | app.launchArguments.append(seedRecentSearchesArgument) | |
| 81 | } | |
| 70 | 82 | if let contentSizeCategory { |
| 71 | 83 | app.launchArguments += ["-UIPreferredContentSizeCategoryName", contentSizeCategory] |
| 72 | 84 | } |
DomainDigUITests/AccessibilityAuditTests.swift +27
| @@ -274,6 +274,33 @@ final class AccessibilityAuditTests: XCTestCase { | ||
| 274 | 274 | /// One launch rather than ten: re-selecting the Settings tab pops it back |
| 275 | 275 | /// to root, so each destination is reached from a known place, and the |
| 276 | 276 | /// store reset means the launch state is the same for all of them. |
| 277 | /// Inspect with its recent-searches section present. | |
| 278 | /// | |
| 279 | /// The section renders only once a lookup has been run, so the empty-state | |
| 280 | /// suite never has it in the tree. Four findings in it were found by | |
| 281 | /// accident, by driving one real lookup; seeding `recentSearches` puts them | |
| 282 | /// under the suite on purpose and keeps the launch deterministic. | |
| 283 | /// | |
| 284 | /// Gated on everything the project enforces except `.dynamicType`, which | |
| 285 | /// still reports against the "RECENT" header. That one is the | |
| 286 | /// position-dependent finding described in `Docs/ACCESSIBILITY.txt`, not a | |
| 287 | /// property of the header — unlike the other seeded tests, nothing else | |
| 288 | /// here needs to stay report-only. | |
| 289 | func testSeededRecentSearches() throws { | |
| 290 | let app = AccessibilityAuditHarness.launch(recentSearches: true) | |
| 291 | app.selectRootTab("Inspect") | |
| 292 | XCTAssertTrue( | |
| 293 | app.staticTexts["RECENT"].waitForExistence(timeout: 10), | |
| 294 | "The recent-searches section must render, or this audits nothing" | |
| 295 | ) | |
| 296 | try AccessibilityAuditHarness.audit( | |
| 297 | app, | |
| 298 | screen: "recent-searches", | |
| 299 | test: self, | |
| 300 | enforcing: AccessibilityAuditHarness.enforcedAuditTypes.subtracting(.dynamicType) | |
| 301 | ) | |
| 302 | } | |
| 303 | ||
| 277 | 304 | func testSettingsDestinations() throws { |
| 278 | 305 | let destinations = [ |
| 279 | 306 | "Display", |