[Bug]: element-token scroll aims outside the window when the element is taller than it
Primary area
Cua Driver
Summary
On macOS, scroll with an element token aims the wheel at the centre of the element's full AX frame. When the element is taller (or wider) than the window, as a long text view or web area usually is, that centre lies outside the window, so background delivery is refused even though most of the window is that element.
Reproduction
- Open a window whose scrollable content element is taller than the window, for example a long document in a text view or web area.
get_window_statefor that window and take the content element'selement_index.- Call
scrollwith thatelement_index,delivery_mode: background, and a direction that takes the wheel path (left/right for an AppKit text area; up/down there goes through the AX scroll bar instead).
Seen every time on an element taller than the window. Pixel-targeted scroll at a window-local point inside the same element works.
Expected behavior
The wheel is posted at a point that is on the element and inside the window, and the element scrolls.
Actual behavior
The tool returns the outside-window refusal from tools/scroll.rs:
scroll: window-local point (…) pt lies outside window <id>'s W×H pt frame; background delivery refused
The window-local point is the centre of the whole element frame, which sits below (or past) the window edge.
Environment
Cua component and version/commit: cua-driver 0.34.0 (seen); code path unchanged on main at 9c97c20ad
Operating system and architecture: macOS 26.7.1, arm64
Application/browser/window system/image: native macOS apps; AppKit text area and long scroll views
Evidence
No reproduction recording available. I saw the refusal while driving a real window with 0.34.0 but did not keep the exact output, and a later attempt with the AppKit fixture did not reach the wheel path because the fixture window opened on another Space (off_space_or_ax_unresolved).
Code path: after AXScrollToVisible, the element branch of ScrollTool takes element_screen_center(element) as the wheel point. For an element larger than the window, AXScrollToVisible cannot bring that centre on screen, and the background guard then refuses the out-of-frame point.
Workaround and additional context
Workaround: scroll by window-local screenshot pixels instead of the element token.
Suspected fix: aim at the centre of the element frame intersected with the window bounds, and keep the old centre (and the existing refusal) when they do not overlap. ax/reveal_scroll.rs already has an intersect helper for this. I have a small PR with unit tests ready.
Submission checks
- [x] I searched for duplicate issues and active pull requests.
- [x] This issue describes a single problem.
- [x] I removed credentials, private data, sensitive screenshots, and vulnerability details from this public report.
Thanks for the report and for the fix in #5365. Linking the two; we'll review the PR there.