You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 8599bd4
Browse filesBrowse the repository at this point in the historyBrowse files
fix(desktop): refuse unverifiable clicks, stop menu completion on cancel, scope press_key
- Refuse coordinate input when Accessibility cannot say which app owns the point
- Check cancellation before the menu-completion Return
- press_key goes to the observed window or a dialog, panel or popover above it,
never another document window
- Only presses treat an Accessibility timeout as delivered; a value or selection
change that times out fails as uncertain
guard result ==.success else{throwComputerError("accessibility_error","Accessibility operation failed (\(result.rawValue)); observe the app again before retrying.")}
48
48
}
49
49
/// A press that opens a sheet, alert or modal panel holds the app's Accessibility reply until that UI
50
-
/// is up, so `cannotComplete` after the messaging timeout means the request was delivered, not refused.
guard snapshot.windowFrames[windowId]== frame else{throwComputerError("stale_window","Observe the target window again.")}
689
686
letroot=AXUIElementCreateApplication(pid)
690
-
// Keys go to the app's key window, which may be a sheet, panel or popover above the observed one.
691
-
guardlet focusedWindow =attribute(root, kAXFocusedWindowAttribute),CFGetTypeID(focusedWindow)==AXUIElementGetTypeID()else{throwComputerError("focus_failed","The app has no focused window to receive keys; click a window or call activate_app, then observe again.")}
687
+
// Keys go to the app's key window: the observed window, or a dialog, panel or popover above it,
688
+
// but never another document window the snapshot did not observe.
689
+
guardlet rawWindow =attribute(root, kAXFocusedWindowAttribute),CFGetTypeID(rawWindow)==AXUIElementGetTypeID()else{throwComputerError("focus_failed","The app has no focused window to receive keys; click a window or call activate_app, then observe again.")}
guardelementRect(focusedWindow)== frame || attribute(focusedWindow, kAXSubroleAttribute)as?String!= kAXStandardWindowSubrole else{throwComputerError("focus_failed","Another document window has keyboard focus; observe that window and target it instead.")}
0 commit comments