Skip to content

native2: describe out-of-process Open panels accurately (#200) - #219

Merged
iamnbutler merged 2 commits into
mainfrom
fix-open-panel
Oct 25, 2026
Merged

iamnbutler merged 2 commits into
mainfrom
fix-open-panel

Conversation

@iamnbutler

Copy link
Copy Markdown
Contributor

Fixes #200

Investigated with a sandboxed test app whose NSOpenPanel is drawn by com.apple.appkit.xpc.openAndSavePanelService:

  • Host app pid: the app lists the panel as its own window, and Accessibility exposes the full tree through it (remote elements are owned by the service pid). desktop_inspect, desktop_dialog and background desktop_click work there; clicking the Downloads sidebar row in the background changed the folder.
  • Service pid: lists a proxy window with the same title and bounds that Accessibility can't see; this (and sheets such as Go to Folder) is what the report saw as limited / no_matching_accessibility_window.
  • Keys: the app reports a focused window but no AXFocusedUIElement; the service holds focus only while active. Posting ⇧⌘G to the app pid or the service pid in the background does nothing (tried both), so background keys aren't feasible.

Changes:

  • Service-owned windows get availability open_save_panel_service with a hint to use the app's panel window and desktop_dialog_answer path, instead of "not on screen, bring it forward".
  • Keys and typing into a window whose focus is in another process's content are refused with a specific message and hint (click works; path via desktop_dialog_answer), not the generic focus refusal.
  • New recipe in docs/recipes.md: "Choose a file or folder in an Open panel".

Not done: the issue's one-off "no usable Accessibility elements" after a click didn't reproduce on a standalone panel; it looks like a transient read while the panel reloaded. A 200-element inspect of the panel is mostly sidebar; #178 (#212) defers its offscreen rows. I didn't run desktop_dialog_answer path live because it's foreground and would take the keyboard focus; the recipe follows its code.

swift test passes (new Availability case); smoked on the dev app (native2).

A sandboxed app's Open panel is drawn by the open and save panel service. Its
own windows (the panel's proxy and sheets such as Go to Folder) were listed as
off screen or limited, with hints to focus them; they're now
open_save_panel_service, pointing at the app's panel window. Keys into the
panel, which the service holds and background events don't reach, are refused
with how to click it or enter a path instead. Adds a recipe.

Why: native2/Sources/DesktopMac/Keyboard.swift#fn requireKeyboardFocus | a sandboxed Open panel reports no AXFocusedUIElement for its app, and keys posted to the app or the panel service pid don't reach it in the background (checked live); background clicks do work
@iamnbutler
iamnbutler merged commit 112b8d7 into main Oct 25, 2026
2 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.

NSOpenPanel: Accessibility tree incomplete, and the Go to Folder sheet is not reachable

1 participant