Skip to content

feat(android): add TalkBack accessibility via accesskit_android (#2697) - #2713

Merged
Hona merged 1 commit into
devfrom
feat/android-talkback
Nov 28, 2026
Merged

Hona merged 1 commit into
devfrom
feat/android-talkback

Conversation

@Hona

@Hona Hona commented Nov 28, 2026

Copy link
Copy Markdown
Member

Implements Android TalkBack accessibility for dev.rune.RuneView.

Summary

  • AccessKit Android adapter (crates/rune/Cargo.toml, crates/rune/src/a11y/android/, crates/rune/src/platform/android/a11y.rs): adds optional accesskit_android = "0.9.1" under the accessibility feature on target_os = "android", wired through the existing AccessibilityLink on the UI thread (createAccessibilityNodeInfo, findFocus, performAction, and touch-exploration dispatchHoverEvent). All QueuedEvents::raise calls run strictly after releasing the thread-local HOST borrow so synchronous framework callbacks cannot re-enter RefCell. All JNI native methods remain registered with safe no-op fallbacks when feature = "accessibility" is disabled.
  • Passive host root (crates/rune/android/src/main/java/dev/rune/RuneView.kt): strips focusable/clickable/accessibility-focus actions from HOST_VIEW_ID (-1) and onInitializeAccessibilityNodeInfo, moves any root title into API 28+ paneTitle, and returns null from findFocus(FOCUS_INPUT) while keyboard focus sits on the root Window so TalkBack walks the virtual subtree instead of stopping on the view itself.
  • Per-role screenReaderFocusable & isHeading grouping (crates/rune/src/a11y/android/focusable.rs): follows the per-role rule endorsed in Android: TalkBack #2697—ListItem, Article, Heading, and Paragraph stay a single swipe stop (with isHeading = true on Heading, API 28+) without splitting plain-text children, while standalone Label leaves (and standalone labelled Image leaves) outside grouping ancestors or leaf controls get screenReaderFocusable = true so TalkBack does not merge a scroll viewport's content into one announcement.
  • 100 ms scroll-pacing state machine (crates/rune/src/a11y/android/throttle.rs): explicit Rest / Cooldown / Holding state machine (rune::machine) that syncs immediately at rest, caps syncs to at most once per 100 ms while any viewport has active scroll motion (RuntimeCore::a11y_scroll_active), flushes at once on the first resting frame, and schedules a fenced Attempt wake when frames stop.

Verification

  • Host unit tests (cargo test -p rune --lib a11y::android): 10/10 passing (5 scroll-pacing tests covering rest, hold, 1 s 120 Hz fling, resting-frame flush, and scheduled/stale wakes; 5 per-role focusability and Runtime::accessibility_tree() tests).
  • Host Android lifecycle tests (cargo test -p rune --lib platform::android::machine): passing.
  • cargo check -p rune --no-default-features: passing.
  • Android cross-compilation (aarch64-linux-android, x86_64-linux-android with rune/accessibility) and Kotlin/APK compilation (RuneView.kt via kotlinc + d8): verified by the android CI workflow.
  • Not run locally on a physical Android device or TalkBack emulator.

Fixes #2697

@Hona
Hona force-pushed the feat/android-talkback branch 2 times, most recently from 856533e to ee0ae74 Compare November 28, 2026 02:46
@Hona
Hona force-pushed the feat/android-talkback branch from ee0ae74 to 6b7940f Compare November 28, 2026 02:51
@Hona
Hona merged commit adb52ae into dev Nov 28, 2026
5 checks passed
@Hona
Hona deleted the feat/android-talkback branch November 28, 2026 02:53
@Hona Hona mentioned this pull request Nov 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Android: TalkBack

1 participant