Skip to content

idb ui can read accessibility custom actions but cannot perform them #978

Open

Description

@bohan-v

Description

idb ui can read an element's accessibility custom actions, but there is no way to perform one.

describe-all / describe-point / describe already return custom_actions (e.g. ["Increase quantity", "Decrease quantity"]). idb ui tap (marker mode) presses, idb ui scroll scrolls, and idb ui set-value sets values, but there is no command to run a UIAccessibilityCustomAction by name.

This matters because some controls are reachable through accessibility only as custom actions. A common example is a product card with a quantity stepper: the card is one accessibility element, the +/− buttons are not exposed as separate elements, and VoiceOver users change quantity through the Actions rotor (accessibilityCustomActions in UIKit, .accessibilityAction(named:) in SwiftUI). For an automation client this leaves two bad options:

  • an HID tap at guessed coordinates inside the card. The icons are not in the tree, so the point can't be verified, and a wrong guess can hit a different control (e.g. open the product page instead of adding one).
  • injecting code into the app (e.g. through idb-repl app) to walk the UIKit accessibility tree and call actionHandler / target.perform(selector) directly. This works, but it is slow (compiles on every call), relaunches the app unless it was started with idb launch --enable-repl, and runs automation code inside the process under test.

Expected: a way to perform a named custom action on an element resolved by marker, with the same backend selection, matching options and safety checks as idb ui tap marker mode.

Reproduction

Any element with a custom action, e.g. in a SwiftUI test app:

struct Stepper: View {
  @State var count = 0
  var body: some View {
    Text("Bananas, \(count) in cart")
      .accessibilityElement()
      .accessibilityAction(named: "Increase quantity") { count += 1 }
  }
}
  1. The action is visible to idb:

    idb ui describe --udid <UDID> --api axbridge --match-key AXLabel -- "Bananas"
    # ... "custom_actions": ["Increase quantity"] ...
  2. Nothing in idb ui --help can perform it: tap, scroll, set-value, button and the rest press, gesture, scroll or set values, but none takes an action name.

  3. The guest bridge already has a perform verb, but its action set is fixed and doesn't include custom actions:

    G=$(brew --prefix idb-companion)/libexec/Resources/SimulatorFrameworkBridge-iOS
    xcrun simctl spawn <UDID> "$G" accessibility perform --pid <PID> --action customAction
    # {"ok":false,"error_kind":"bad_request","error":"unsupported action: customAction"}

    The supported actions in this binary appear to be press, scrollUp, scrollDown, scrollLeft, scrollRight and scrollToVisible.

Solution

Most of the pieces seem to be in place already: axbridge reads customActions, and the write path (AXBridgeWriteRequest, the "element had moved… nothing was written" guard, --reason) already handles press and scroll. A possible shape:

  • Guest bridge: add a custom-action entry to accessibility perform that takes the action name, resolves it against the element's custom actions, and invokes it through the accessibility runtime (the same entry point VoiceOver's Actions rotor uses). If the name is missing or ambiguous, it should return a no-write error so callers can tell nothing was performed.

  • Companion / gRPC: an additive request kind on the existing accessibility write path.

  • CLI: for example

    idb ui custom-action --udid <UDID> --api axbridge --match-key AXLabel \
      --action "Increase quantity" [--reason "..."] -- "Bananas"

    with the same --match-key, --ignore-case, --depth and --api options as ui tap, and the same distinction between "nothing was written" and a confirmed perform.

I haven't checked whether the AXPTranslator / AXRuntime path accepts a "perform custom action" request, or only press, increment, decrement and scroll. Xcode's Accessibility Inspector lists custom actions on Simulator elements, which suggests the platform supports it. Happy to test a branch.

Additional Information

  • idb revision: client fb-idb 1.6.5 (pipx), companion idb-companion 1.6.5 (Homebrew facebook/fb)
  • Xcode 26.6 (17F113), macOS 26.7, iPhone 17 simulator on iOS 26.5

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions