Android: expose Node::custom_actions as AccessibilityActions (design question: id mapping)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 35/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- android, rust
- Ambito
- accessibility, mobile
Direzione di ricerca
Read the core definitions of Action::CustomAction, CustomAction, and Node::custom_actions(), then inspect the Android adapter’s node-info and perform_action paths. The issue gives a prototype behavior, but implementation depends on resolving the Android ID mapping and whether core docs or other adapters should change. Done means an agreed design and Android actions that appear, dispatch to valid current custom actions, and handle stale IDs safely.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
The core crate already defines Action::CustomAction, ActionData::CustomAction(i32), CustomAction { id, description } and Node::custom_actions(), but no platform adapter currently exposes them (iOS only treats supports_action(CustomAction) as an "interactive" hint). The Android adapter could be the first to implement them, so before sending a PR I'd like to agree on how it should behave.
What I'd implement
- For each node with
supports_action(Action::CustomAction), add oneAccessibilityNodeInfo.AccessibilityActionper entry incustom_actions(), usingdescriptionas the label. These appear in TalkBack's Actions menu. - In
perform_action, map an incoming custom id back toActionRequest { action: Action::CustomAction, data: Some(ActionData::CustomAction(id)) }. - Only accept an id that is in the node's current
custom_actions(), so stale cached node info can't trigger an action that was removed. Skip actions with an empty description.
The open question is the id mapping
CustomAction::id is an arbitrary i32 chosen by the application, while Android requires custom action ids to avoid the framework's own android.R.id ids and to be above the legacy range (ids ≤ 0x200000 are treated as legacy bitmask actions). Options I considered:
- Fixed offset:
base + id, withidrestricted to a documented range (my prototype uses0x3f000000 + [0, 0xFFFFFF]). Stateless, round-trips exactly, and a stale id fails safely because it is checked against the node's current list. Flutter uses a similar offset scheme. - Fixed slot pool (as Jetpack Compose does, 32 slots): a hard cap, and it relies on androidx resource ids that a standalone adapter doesn't have.
- Adapter-side table: allocate Android ids from a counter and keep a
(node, custom id)map. Supports anyi32, but adds state that can go stale with TalkBack's cached node info. - Index in
custom_actions(): no restriction on app ids, but the Android id changes whenever the list is reordered, so cached info could target the wrong action.
I lean towards option 1. Is restricting ids to a documented range acceptable, or would you prefer a different approach? If 1 is fine, I'd also document the supported range on CustomAction::id.
Related questions
- Should the core docs say that adapters may reject ids outside a platform-specific range?
- Should other adapters (AT-SPI actions,
NSAccessibilityCustomAction) follow later, so the semantics stay consistent across platforms?
Context and disclosure
I maintain a fork used by NVGT (a game engine used by blind developers), where this is needed for TalkBack users: per-item actions on list items such as "Move up" or "Remove". I already have a working prototype in the fork, tested on a physical realme RMX5032 running Android 16 (API 36) with Google TalkBack 17.1.0 and with BackTalk: the actions appear in the TalkBack actions menu, run, and per-item actions on list items work.
I use AI tooling (Claude) for this work, including researching Android's behaviour, writing the implementation and unit tests, and reviewing it. I will review, test and take responsibility for anything I submit. I wanted to say that up front, in case the project has a position on AI-assisted contributions. If it does, I'll follow it, and I'm happy to open nothing further if it isn't welcome.
I saw that AccessKit no longer accepts external pull requests (#832), so this is an issue to agree on the design first. If the plan looks reasonable, I'd be glad to send the PR as a member.
- Lingua principale
- Rust
- Stelle
- 1.5k
- Fork
- 127
- Merge medio
- 16h 45m
- PR unite (30g)
- 12
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di AccessKit/accesskit
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Document sub-treesAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
Document `Role::ColorWell`Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 56/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 52/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di AccessKit/accesskit
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 92/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
yunfie-twitter/Palleria#474 ·
I maintainer di solito rispondono entro 1 giorno
-
good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
servo/rust-smallvec#827 ·
I maintainer di solito rispondono entro 1 giorno