feat(android): publish clickable, focusable, long-clickable and scrollable on snapshot nodes
What
Android snapshot nodes publish four accessibility facts next to hittable:
clickable,focusableandscrollable: the reader already parses these and drops them at the projection.longClickable: the snapshot helper now writeslong-clickable(a comment inAccessibilityTreeXml.javalisted it as declared residue of #1832), with both answers, so a capture from an older helper reports nothing instead offalse.
Why
hittable is true for a node that is clickable, focusable or focused. That is the right question for driving a screen, and it hides a difference an accessibility check needs: a node a screen reader can land on but cannot activate is hittable, and so is one it can activate.
My case is a suite that tests native controls hosted in a React Native app (Compose inside React Native views). It asserts things like "the node carrying the control's name is the clickable one" and "a control with a long-press menu offers a long click". Today those few assertions need adb shell uiautomator dump, which cannot run while the helper session holds the accessibility connection, so they live in a separate pass after the suite.
From a build of this branch, on an API 35 emulator (snapshot --json --raw):
"Message from Grace" hittable: true clickable: false focusable: true longClickable: true
a plain container clickable: false focusable: false longClickable: false
ScrollView hittable: true clickable: false focusable: true scrollable: true
The first line is the case hittable cannot tell apart from a button.
The part I am unsure about
snapshot-private-evidence.ts says clickability is deliberately kept outside SnapshotNode, and two tests in snapshot-clickability.test.ts asserted that clickable never appears on a published node. This change reverses that, and I changed those two tests to match. If you would rather keep the default node as it is, I am happy to put these behind an opt-in capture option (the way --actions works), or publish them on --raw captures only. Tell me which you prefer.
It also adds four booleans to every Android node in --json output. The text snapshot is unchanged.
State
pnpm lintandpnpm typecheckpass. Theplatform-androidand capture unit tests pass (1,548).- Not done yet: the full
check:affectedrun, a test in the helper's own suite for the new attribute, docs.
![Autofix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png)
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.