Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"accesskit":"0.25.1","accesskit_consumer":"0.39.1","adapters/macos":"0.27.1","adapters/windows":"0.35.1","adapters/winit":"0.34.1","adapters/unix":"0.24.0","adapters/atspi-common":"0.21.0","adapters/android":"0.9.0","adapters/ios":"0.2.1","example_common":"0.0.1"}
{"accesskit":"0.25.1","accesskit_consumer":"0.39.1","adapters/macos":"0.27.1","adapters/ohos":"0.1.0","adapters/windows":"0.35.1","adapters/winit":"0.34.1","adapters/unix":"0.24.0","adapters/atspi-common":"0.21.0","adapters/android":"0.9.0","adapters/ios":"0.2.1","example_common":"0.0.1"}
57 changes: 57 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ members = [
"adapters/atspi-common",
"adapters/ios",
"adapters/macos",
"adapters/ohos",
"adapters/unix",
"adapters/windows",
"adapters/winit",
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ The current released platform adapters are all at rough feature parity. They don
The following platform adapters are currently available:

* [Android adapter](https://crates.io/crates/accesskit_android): This adapter implements the Java-based Android accessibility API.
* [OpenHarmony adapter](https://crates.io/crates/accesskit_ohos): This adapter implements the ArkUI native accessibility provider API.
* [iOS adapter](https://crates.io/crates/accesskit_ios): This adapter implements the UIAccessibility protocols in the UIKit framework.
* [macOS adapter](https://crates.io/crates/accesskit_macos): This adapter implements the NSAccessibility protocols in the AppKit framework.
* [Unix adapter](https://crates.io/crates/accesskit_unix): This adapter implements the AT-SPI D-Bus interfaces, using [zbus](https://github.com/dbus2/zbus), a pure-Rust implementation of D-Bus.
Expand Down
8 changes: 8 additions & 0 deletions adapters/ohos/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changelog

All notable changes to this project will be documented in this file.

## [Unreleased]

- Add the initial OpenHarmony ArkUI accessibility adapter.
- Default the adapter to API 13 and make API 24 component identifiers opt-in.
32 changes: 32 additions & 0 deletions adapters/ohos/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[package]
name = "accesskit_ohos"
version = "0.1.0"
authors.workspace = true
license.workspace = true
description = "AccessKit UI accessibility infrastructure: OpenHarmony adapter"
categories.workspace = true
keywords = ["gui", "ui", "accessibility", "openharmony"]
repository.workspace = true
readme = "README.md"
edition.workspace = true
rust-version = "1.88"

[features]
default = ["api-13"]
api-13 = ["ohos-accessibility-binding/api-13"]
api-14 = ["api-13", "ohos-accessibility-binding/api-14"]
api-15 = ["api-14", "ohos-accessibility-binding/api-15"]
api-16 = ["api-15", "ohos-accessibility-binding/api-16"]
api-17 = ["api-16", "ohos-accessibility-binding/api-17"]
api-18 = ["api-17", "ohos-accessibility-binding/api-18"]
api-19 = ["api-18", "ohos-accessibility-binding/api-19"]
api-20 = ["api-19", "ohos-accessibility-binding/api-20"]
api-21 = ["api-20", "ohos-accessibility-binding/api-21"]
api-22 = ["api-21", "ohos-accessibility-binding/api-22"]
api-23 = ["api-22", "ohos-accessibility-binding/api-23"]
api-24 = ["api-23", "ohos-accessibility-binding/api-24"]

[dependencies]
accesskit = { version = "0.25.0", path = "../../accesskit" }
accesskit_consumer = { version = "0.39.0", path = "../../accesskit_consumer" }
ohos-accessibility-binding = { version = "0.1", default-features = false }
58 changes: 58 additions & 0 deletions adapters/ohos/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# accesskit_ohos

AccessKit adapter for the ArkUI native accessibility provider API on
OpenHarmony/HarmonyOS NEXT.

The adapter is attached to an accessibility `Provider` obtained from an
XComponent or an `ARKUI_NODE_CUSTOM`. It retains the AccessKit tree, answers
ArkUI's synchronous node queries, forwards native actions to AccessKit, and
reports tree/focus changes back to ArkUI.

```rust,ignore
let provider = xcomponent.accessibility_provider()?;
let adapter = accesskit_ohos::Adapter::new(
provider,
activation_handler,
action_handler,
)?;

adapter.update_if_active(|| next_tree_update());
```

`Adapter::new` uses the standard callback registration for a single ArkUI custom
node or XComponent. The binding permits only one such registration per process.
For multiple XComponent windows or recreated surfaces, enable `api-15` and use
`Adapter::new_with_instance` with a unique ID for each registration, so late
callbacks cannot reach another window or a replacement surface's tree.

Drop the adapter before destroying the XComponent or custom node that owns its
provider.

The OpenHarmony native API does not expose an unregister function. Dropping
the adapter disables its Rust callback target, so any late native callback
returns a failure without touching released application state.

Action descriptions use static C strings because ArkUI snapshots retain their
description pointers. Event submission keeps its attached element alive through
the binding's borrowed event lifetime.

## API levels

The adapter defaults to the `api-13` feature, which is sufficient for an
XComponent accessibility provider and for all core tree, action, and event
operations. Higher API features form an additive ladder:

- API 15 adds multi-instance callback registration and next/previous HTML item
action handling.
- An ArkUI `ARKUI_NODE_CUSTOM` host needs API 23 to obtain its accessibility
provider. This requirement belongs to the ArkUI host integration; the
adapter still only consumes the resulting `Provider`.
- Enable `api-24` when AccessKit `author_id` values must be exposed through
ArkUI's `componentIdentifier` property.

Applications should select the highest API feature supported by their minimum
deployment target. Enabling `api-24` is not required for the core adapter.

## License

MIT OR Apache-2.0
Loading