Repository navigation
fix(macos): let a sheet or popover frame replace its window's viewport - #27
Merged
Merged
Conversation
System Settings popup buttons answer kAXErrorNoValue for AXWindow even though an AXWindow encloses them. ancestor_viewport then had no viewport, the live offscreen state stayed unknown, and because a popup button never reports AXExpanded the actionability gate waited out its whole 5 s budget. select, click and expand on these popups failed with TIMEOUT and a "target may be busy" suggestion. When AXWindow has no value, the viewport now starts from the first AXWindow in the parent chain. A chain that reaches the application without a window, as open menu content does, still has no viewport.
An open popup menu hangs off its popup button, so its parent chain passes through the enclosing AXWindow. The window-ancestor fallback would have given menu items that window's viewport, and an item drawn outside the window would read as offscreen. The search now stops at the first menu role, so menu content keeps no viewport, as it had before the fallback. Measured on a System Settings popup: select takes about 2.9 s with and without this guard, and changes the value in both builds.
The carried window-ancestor fallback put element_bounds.rs at 406 lines, over the 400-line cap; its inline tests now live in element_bounds_tests.rs as the layout rule asks.
…e content or failing reads Review of the carried fallback found three gaps. A menu or popover used as the start element still walked up to its host window and read as offscreen; a popover's content was not stopped at all; and an unreadable parent chain on the fallback now failed state reads that used to report an unknown viewport. The search now starts at the element itself, stops at AXPopover as well as the menu roles, and any fallback read failure leaves the viewport unknown as before. The primary AXWindow path and its clipping walk are unchanged.
A Save sheet wider than its document window had every control past the window's edge judged offscreen, because the sheet's frame was intersected with the window's. Actionability then refused the Save button and sidebar cells. A sheet or popover is its own window, so its frame now replaces the inherited viewport in snapshot traversal, ends the live clip walk, and is the last clip in the pointer hit test.
gshost1
added a commit
that referenced
this pull request
Nov 8, 2026
gshost1
added a commit
that referenced
this pull request
Nov 8, 2026
Main carries #6 as a squash, so its element_bounds conflicts with this branch's copy. Main's clip_by_ancestors is the version this fix was written against; both hunks keep this branch's side.
gshost1
marked this pull request as ready for review
November 8, 2026 14:55
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.
Stacked on #6 (
fix/popup-window-viewport). Merge #6 first, then retarget this PR tomain.What and why
TextEdit's Save sheet is wider than its document window. The clipping viewport intersected the sheet with that window, so the actionability gate saw the Save button and the sidebar cells as offscreen and refused to click them. This was the main cause of slow TextEdit Save runs in the bench: the model kept retrying until it fell back to keyboard input.
A sheet or popover draws its own surface, so its frame now replaces the window as the viewport base:
draws_own_surface(role)matchesAXSheetandAXPopover.clipped_viewportreturns an own-surface element's own bounds.clip_by_ancestorsstops at the nearest window or own surface. The newviewport_from_clipsthen folds the clips below that base. Scroll areas inside a sheet still narrow the viewport.hit_testkeeps itsvisibleverdict after clipping by an own-surface role.The lesson is in
docs/solutions/runtime-errors/2026-11-07-sheet-wider-than-its-window.md.How tested
-D warnings, library tests over the host set).element_bounds_tests.rsand 1 inhit_test_tests.rs. Removing the fix made 3 of them fail:a_sheet_wider_than_its_window_keeps_its_far_controls_visibleclips_inside_a_sheet_still_narrow_its_viewportsnapshot_traversal_entering_a_sheet_takes_the_sheet_frameRisks
What's left
mainafter fix(macos): find the window of a control that omits AXWindow (carry #453) #6 merges.