Commit 898da24eee

898da24eee15a9a94922d29e8f3d6be0f5dceda2

parent: 3468e9b969

Unsigned

cmc <hello@cleberg.net> · 2026-11-03 14:56 UTC

Make recent-search chips fire only their own action (!70)

Inspect's RECENT chips and the Clear button share one `List` row. A row holding several default-style buttons fires every button's action on one tap, so a tap cleared the list and ran every chip in order, and the last chip's lookup won. The buttons are borderless now.

`RecentSearchesTests` taps one chip, clears, taps another, and checks the field holds the tapped domain. It failed before the change (first chip tapped, last chip run).

386 unit and 23 UI tests green. The pre-push audit passed on both tiers.

Layout: unified · split

DomainDig/ContentView.swift +4
@@ -593,6 +593,7 @@ struct ContentView: View {
593 // WCAG 2.5.8 floor, which is what the audit reports here. 593 // WCAG 2.5.8 floor, which is what the audit reports here.
594 .frame(minWidth: AppLayout.minimumTapTarget, minHeight: AppLayout.minimumTapTarget) 594 .frame(minWidth: AppLayout.minimumTapTarget, minHeight: AppLayout.minimumTapTarget)
595 .contentShape(Rectangle()) 595 .contentShape(Rectangle())
596 .buttonStyle(.borderless)
596 .accessibilityLabel("Clear recent searches") 597 .accessibilityLabel("Clear recent searches")
597 } 598 }
598 599
@@ -611,6 +612,9 @@ struct ContentView: View {
611 .background(ThemeToken.surface) 612 .background(ThemeToken.surface)
612 .clipShape(RoundedRectangle(cornerRadius: appDensity.metrics.cardCornerRadius)) 613 .clipShape(RoundedRectangle(cornerRadius: appDensity.metrics.cardCornerRadius))
613 } 614 }
615 // Every button in this one List row fires on a tap unless it
616 // is borderless.
617 .buttonStyle(.borderless)
614 // A bare domain reads as neither a word nor an action; the 618 // A bare domain reads as neither a word nor an action; the
615 // button re-runs the lookup, so say that. 619 // button re-runs the lookup, so say that.
616 .accessibilityLabel("Look up \(domain)") 620 .accessibilityLabel("Look up \(domain)")
DomainDigUITests/RecentSearchesTests.swift added +32
@@ -0,0 +1,32 @@
1import XCTest
2
3@MainActor
4final class RecentSearchesTests: XCTestCase {
5
6 override func setUp() {
7 continueAfterFailure = false
8 }
9
10 /// Run one recent search, clear the results, then pick a different one.
11 /// The second pick must run the domain that was tapped, not the one run
12 /// before it.
13 func testTappingARecentSearchRunsThatDomain() {
14 let app = AccessibilityAuditHarness.launch(recentSearches: true)
15 app.selectRootTab("Inspect")
16
17 let field = app.textFields["e.g. cleberg.net"]
18 XCTAssertTrue(field.waitForExistence(timeout: 10))
19
20 app.buttons["Look up healthy.example"].tap()
21 XCTAssertEqual(field.value as? String, "healthy.example")
22
23 let clear = app.buttons["Cancel lookup"].exists ? app.buttons["Cancel lookup"] : app.buttons["Clear results"]
24 clear.tap()
25
26 let next = app.buttons["Look up broken.example"]
27 XCTAssertTrue(next.waitForExistence(timeout: 10))
28 next.tap()
29
30 XCTAssertEqual(field.value as? String, "broken.example")
31 }
32}