Skip to content

Commit d9ae20c

Browse files
committed
improvement(computer-use): report an advertised action the element refuses as unsupported, with the snapshot still valid
1 parent 0a19cdf commit d9ae20c

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎apps/desktop/native/computer-use/ComputerUse.swift‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ func dispatchAX(_ element: AXUIElement, press: Bool = false, _ operation: (AXUIE
5656
let result = operation(element)
5757
if ![.illegalArgument, .attributeUnsupported, .actionUnsupported, .notImplemented, .apiDisabled].contains(result) { inputDispatched = true }
5858
if result == .success || result == .cannotComplete && press { return }
59+
// Some elements advertise an action they then refuse (Finder and file-panel cells with AXOpen); nothing reached the app.
60+
if result == .actionUnsupported {
61+
throw ComputerError("unsupported_action", "The element advertises this action but refused it. Use another of its actions or click it instead (clickCount 2 opens most files and folders).")
62+
}
5963
try axCheck(result)
6064
}
6165
/// Some apps (Calendar on macOS 26) answer AXPress on a menu item by opening its menu with the item

0 commit comments

Comments
 (0)