Crate xa11y

Crate xa11y 

Source
Expand description

xa11y — Cross-Platform Accessibility Client Library

Provides a unified API for reading and interacting with accessibility trees across desktop platforms (macOS, Windows, Linux).

§Quick Start

use xa11y::*;

let provider = create_provider().expect("Failed to create provider");
let status = provider.check_permissions().expect("Permission check failed");

match status {
    PermissionStatus::Granted => {
        let tree = provider.get_app_tree(
            &AppTarget::ByName("Safari".to_string()),
            &QueryOptions::default(),
        ).expect("Failed to get tree");

        let buttons = tree.query("button").expect("Query failed");
        println!("Found {} buttons", buttons.len());
    }
    PermissionStatus::Denied { instructions } => {
        eprintln!("Accessibility not enabled: {}", instructions);
    }
}

Modules§

action
error
event
event_provider
locator
node
provider
role
selector
CSS-like selector parser and matcher for accessibility tree queries.
tree

Structs§

AppInfo
Information about a running application.
CancelHandle
Handle to cancel a subscription. Dropping this stops event delivery.
Event
An accessibility event delivered to subscribers.
EventFilter
Filter to narrow which events are delivered.
EventReceiver
Platform-agnostic event receiver.
Locator
A lazy element descriptor that re-resolves against a fresh accessibility tree snapshot on every operation.
Node
A single element in the accessibility tree snapshot.
QueryOptions
Options controlling tree traversal and content.
Rect
Screen-pixel bounding rectangle (origin + size). x/y are signed to support negative multi-monitor coordinates. width/height are unsigned (always non-negative).
StateSet
Boolean state flags for a node.
Subscription
A live event subscription. Drop to unsubscribe.
TextChangeData
Details about a text change event.
Tree
A snapshot of an application’s accessibility tree.

Enums§

Action
A normalized enum of interactions that can be performed on accessibility elements.
ActionData
Data associated with an action.
AppTarget
Target for identifying an application.
ElementState
Desired element state for wait_for operations.
Error
Structured error type for xa11y operations. Designed to be informative across FFI boundaries.
EventKind
Categories of accessibility events, normalized across platforms.
PermissionStatus
Result of a permission check.
RawPlatformData
Platform-specific raw data attached to every node.
Role
A normalized enum covering UI element types across all platforms. Derived from ARIA roles, scoped to roles commonly surfaced by real desktop applications.
ScrollDirection
Direction for scroll actions.
StateFlag
Individual state flags, for use in StateChanged events and filters.
TextChangeType
The type of text modification.
Toggled
Tri-state toggle value.
WindowHandle
Platform-specific window handle.

Traits§

EventProvider
Optional trait for backends that support event subscriptions. Extends Provider with reactive capabilities.
Provider
Platform backend trait for accessibility tree access.
ProviderExt
Extension trait to create Locators directly from a Provider.

Functions§

create_event_provider
Create a platform-appropriate event provider (supports subscribe/wait).
create_provider
Create a platform-appropriate accessibility provider.

Type Aliases§

Result
Result type alias for xa11y operations.