Skip to content

fix: only expand point-click descendants that can hold the point (#147) - #157

Merged
iamnbutler merged 3 commits into
mainfrom
click-remote-hit
Oct 20, 2026
Merged

iamnbutler merged 3 commits into
mainfrom
click-remote-hit

Conversation

@iamnbutler

@iamnbutler iamnbutler commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #147.

Cause. A background point click hit-tests the point, then walks the hit's descendants breadth-first and presses the first enabled candidate whose frame contains the point. In System Settings > Spotlight, the hit is the content hosting view. The walk read the rows of the "Results from Apps" list, and SwiftUI materializes those rows when they're read, so the list grew. Everything below it moved down, so Search Privacy… was 40–136 pt below the clicked point by the time frames were checked, and the click was refused as finding no pressable element.

Read-only probes confirmed it: three point-pruned walks left the button at y=757, and one full walk moved it to y=797. A pixel screenshot showed the content had really moved.

Fix. BackgroundInputDriver.descendantsBreadthFirst walks AutomationElementRepresenting and doesn't expand an element whose non-empty frame excludes the point. Elements without a usable frame are still expanded. Off-point candidates were already rejected, so only the reads change, along with the layout those reads could move.

Tests. A new BackgroundInputDriverPositionalTargetTests case models the Spotlight pane. All 31 tests in that suite pass with npm run peekaboo-test -- --package automationkit --filter BackgroundInputDriverPositionalTargetTests.

Live check (dev app). After scrolling Spotlight to the bottom, a point click on Search Privacy… from a pixels snapshot completed and opened its sheet, which I closed with Done. On 0.16.0 the same click was refused every time.

Reading the children of SwiftUI's lazy lists materializes their rows and grows
the layout. The point-click walk read all of System Settings' Spotlight pane, so
the app list grew and moved Search Privacy… off the clicked point before its
frame was checked, and the click was refused.

Why: native/vendor/Peekaboo/Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/BackgroundInputDriver.swift | The point-click descendant walk must not read children of elements whose frame excludes the point: SwiftUI lists materialize rows when read and grow, moving the target off the point (System Settings > Spotlight, #147)
@iamnbutler
iamnbutler merged commit 5add8a6 into main Oct 20, 2026
2 checks passed
@iamnbutler
iamnbutler deleted the click-remote-hit branch October 20, 2026 03:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Point click inside a System Settings button finds no pressable element

1 participant