Skip to content

desktop::uia: live walk test bounds the numbers, not the distance (refs #52) - #55

Merged
blockmandev merged 1 commit into
mainfrom
fix/uia-live-offscreen
Oct 22, 2026
Merged

blockmandev merged 1 commit into
mainfrom
fix/uia-live-offscreen

Conversation

@blockmandev

Copy link
Copy Markdown
Member

The test half of #52.

Problem: the_focused_window_can_be_walked required every element to be within one desktop's size of the desktop. Browsers report real off-screen positions, though:

  • screen-reader text is drawn 1×1 far outside the view (y = -16079 here, which failed 3 of 3 runs);
  • a long page's content sits far below the fold.

Fix: the per-element check now asks whether the coordinates are screen pixels at all: both edges within 2^24 px of the origin, which refuses unset or overflowed values near i32::MIN/i32::MAX. The "window is in the mouse's coordinate space" assertion is unchanged.

Test: plausible_coordinates_are_screen_pixels_not_garbage pins the #52 element, a below-the-fold element and the garbage cases. Control: with plausible() forced true, it fails on "an unset coordinate". UIA tests pass 20/20; fmt and clippy are clean.

Still open in #52: whether the walk itself should drop elements that are entirely off every screen. That's a product decision this PR doesn't make.

…ce from the screen (refs #52)

the_focused_window_can_be_walked required every element within one
desktop's size of the desktop, to catch garbage pixels. Web pages break
that with real elements: UI Automation reports where off-screen content
truly is, and text kept for screen readers is drawn 1x1 far outside the
view -- on one focused page an element at y = -16079 failed the test 3 of
3 times, while CI (no such window) passed. A long page's content far below
the fold would fail it the same way.

The per-element check now asks what it was for: are the numbers screen
pixels at all (both edges within 2^24 px of the origin), refusing unset or
overflowed values near i32::MIN / i32::MAX. That the window is in the
mouse's coordinate space stays checked by the next assertion, unchanged.
plausible_coordinates_are_screen_pixels_not_garbage pins the #52 element, a
far-below-the-fold one and the garbage cases; with plausible() forced true
it fails on "an unset coordinate".
@blockmandev
blockmandev merged commit 8d57103 into main Oct 22, 2026
9 checks passed
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.

1 participant