feat: skip a11y ancestor path on android - #44
Open
cryptotavares wants to merge 1 commit into
Open
cryptotavares wants to merge 1 commit into
cryptotavares wants to merge 1 commit into
Conversation
On Android the a11y snapshot ancestor-role `path` is a chain of widget class names (e.g. `android.widget.FrameLayout`) that dominates the `describe-screen` payload while providing no targeting value — mobile targeting is by a11y `ref` or `testId` only. Thread the device platform into `normalizeSnapshot` and emit an empty `path` for every node on Android instead of accumulating ancestry. iOS and browser behavior are unchanged (iOS parity is unvalidated). `path` stays required on `A11yNodeTrimmed`, so de-dup/compaction consumers (`nodeChanged`, `collapseIdenticalRuns`, `buildOptionSummary`) need no changes.
cryptotavares
force-pushed
the
cryptotavares/remove-ax-tree-path
branch
from
August 13, 2026 22:37
02dbd3a to
3bbda5c
Compare
cryptotavares
marked this pull request as ready for review
August 14, 2026 06:47
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is the current state of things and why does it need to change?
Every
mm describe-screen/ observation payload on Android returns a11y nodes carrying apathfield — the chain of ancestorroles for each node. On Android these are widget class names, e.g.:{ "ref": "e86", "role": "android.view.ViewGroup", "name": "", "path": [ "android.widget.FrameLayout", "android.widget.LinearLayout", "android.widget.FrameLayout", "android.view.ViewGroup", "android.view.ViewGroup", "android.widget.ScrollView", ... ] }The
patharray dominates the output and makes the a11y tree so noisy that reading it in practice requires piping through custom filters to extract the usefulref | testId | namecolumns. For an LLM agent consumingdescribe-screen,pathis pure token bloat with no targeting value — mobile targeting is by a11yrefortestIdonly, never bypath.pathis produced innormalizeSnapshot()(src/platform/mobile-platform-driver.ts), which was platform-agnostic and emitted the ancestor chain on every node for both iOS and Android.What is the solution your changes offer and how does it work?
Thread the device platform into
normalizeSnapshotand, on Android only, emit an emptypath([]) for every node instead of accumulating the ancestor roles during the recursivewalk. iOS and browser behavior are intentionally left unchanged — thepaththere may still carry signal (iOS parity is unvalidated), so this change is scoped strictly to Android.Key design points:
pathstays required on the exportedA11yNodeTrimmedtype (public API contract preserved — nooptionalchurn). Android simply emitspath: [].path: []is a validstring[], the field's only functional consumers — observation de-dup (nodeChanged→arraysEqual(a.path, b.path)), the browser-onlycollapseIdenticalRuns, andbuildOptionSummary— require no changes. On Android,pathjust stops contributing to change detection (arraysEqual([], [])istrue), which is correct since it carried no signal there.this.#backend.platform(authoritative, resolved aftersnapshot()), gating on=== 'android'so bothiosandbrowserretain the previous[...path, role]accumulation.Verification
FrameLayout > LinearLayout > 2 Buttons) receivespath: []; existing iOS assertions (path: ['Window']) remain unchanged as a regression guard.