Skip to content

fix: attribute sheet controls to the window the sheet is attached to - #8

Merged
iamnbutler merged 1 commit into
mainfrom
sheet-identity
Oct 15, 2026
Merged

iamnbutler merged 1 commit into
mainfrom
sheet-identity

Conversation

@iamnbutler

Copy link
Copy Markdown
Contributor

Adds peekaboo-sheet-window.patch for githubnext/ace#378: on TextEdit's Save sheet every desktop mutation refused with "The native Accessibility target could not be revalidated before mutation."

Cause. Before a focus or value write, ActionInputDriver.observationTarget reads the element's identity through DetachedExactWindowFocusReader, which requires a CGWindowID from the element's AXWindow link and nothing else. A sheet is its own WindowServer window, absent from the app's AXWindows, so an exact-window observation reaches it only through the parent window's tree. Its controls link to the sheet, and an Open/Save panel's controls resolve to the Open and Save Panel Service's own window (trycua/cua#4507 observed button → service window 173, AXSheet 172, parent AXWindow 167). The identity read therefore had no usable window and every mutation refused before dispatch.

Change. AXWindowIDResolver.owningWindowID accepts the AXWindow link only when it is a same-process AXWindow, otherwise walks a bounded AXParent chain to the nearest same-process AXWindow; an element with no such ancestor keeps its direct identity. The detached reader resolves through the same helper under its deadline, so element identity, exact-window click receipts and post-write observation agree. Sibling windows are still refused. The upstream unit tests for both files are updated for the new contract.

Verification. npm run check; full native build (node dist/build.js); swift test --filter 'AXWindowIDResolverTests|DetachedExactWindowFocusMetadataTests' (15 passing; the PeekabooAutomationKit test target needed a local, uncommitted default case in ClipboardPasteTransactionGateTests to compile because of an earlier patch). Not verified against a live Save sheet: the Mac was driving a study and no GUI app could be opened. The Ace study lead will rerun scenario 20 step 3.

Save and Open sheets are separate WindowServer windows outside the app's
AXWindows; their controls link to the sheet or to the Open and Save Panel
Service's window, so the detached identity read before focus and value
writes could not resolve the observed window and refused every mutation
(githubnext/ace#378). Resolve the nearest same-process AXWindow instead,
in one helper shared by element identity and the detached reader.
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