Repository navigation
native2: inspect spends its budget on what's on screen first (#178) - #212
Open
iamnbutler wants to merge 2 commits into
Open
iamnbutler wants to merge 2 commits into
iamnbutler wants to merge 2 commits into
Conversation
iamnbutler
force-pushed
the
fix-inspect-offscreen
branch
6 times, most recently
from
October 25, 2026 01:03
2c27a28 to
c1e7841
Compare
The walk sets aside elements entirely outside the window's frame, with their subtrees, and reads them after everything on screen, then numbers elements in tree pre-order as before. Set-aside children don't count toward the per-node child limit. A result over the size limit drops offscreen elements first, and offscreen_omitted counts what was left out. Why: native2/Sources/DesktopMac/Elements.swift#fn walk | with visibleFirst, elements are emitted out of order and renumbered by their child-index path at the end; anything that reads element IDs during the walk sees provisional IDs
iamnbutler
force-pushed
the
fix-inspect-offscreen
branch
from
October 25, 2026 01:18
c1e7841 to
9f886ab
Compare
Merged
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #178
No new parameter: the default ordering changes.
visibleFirst(on for desktop_inspect and the fresh observation after an action), an element whose frame lies entirely outside the window's frame is set aside with its subtree and walked after everything on screen, if budget remains. Set-aside children don't count toward the 100-children-per-node limit (it scans up to 10x), so a long list scrolled to its middle reaches the rows on screen. Element IDs are renumbered in tree pre-order at the end, so scope/subtree logic is unchanged.boundednow picks the fewest drops by binary search over a tiered order: offscreen first, then non-scope roles, then scope roles.offscreen_omittedcounts offscreen elements left out (by the walk's budget or the size limit).visible_onlyflag doesn't seem needed: on-screen content now wins the budget, and offscreen elements still fill whatever is left, which keeps scope targets reachable.Checked on the dev app (native2) with an AppKit fixture: 400 buttons in a scroll view scrolled to the middle. Before: 100 elements listed, all buttons offscreen (btn 0-99, y -5453 to -2483), none visible. After: all 18 visible buttons (btn 190-207) listed, the rest of the 200 filled with offscreen ones,
offscreen_omitted: 211. A scoped inspect of the scroll area lists all 405 in pre-order. New CoreTests case for the tiered drop;swift testpasses.