From 93dd75507dd982b710af81bca77f5534f584f70d Mon Sep 17 00:00:00 2001 From: dannyhw Date: Tue, 17 Nov 2026 11:42:13 +0000 Subject: [PATCH 1/9] feat(android): publish clickable, focusable, long-clickable and scrollable on snapshot nodes A snapshot node carries hittable, which is true for a node that is clickable, focusable or focused. A reader that audits what an accessibility service is offered needs those apart: a node a screen reader can land on but cannot activate is hittable, and so is one it can activate. The Android reader already parses clickable, focusable and scrollable; this publishes them on the node. The snapshot helper now writes long-clickable, with both answers so a capture from an older helper is not read as a node that offers no long click. --- .../snapshothelper/AccessibilityTreeXml.java | 5 +-- .../capture/runtime/snapshot-unchanged.ts | 4 +++ packages/kernel/src/snapshot.ts | 13 ++++++++ .../__tests__/snapshot-clickability.test.ts | 31 +++++++++++++++---- .../src/ui-hierarchy-builder.ts | 4 +++ .../platform-android/src/ui-hierarchy-node.ts | 2 ++ packages/platform-android/src/ui-hierarchy.ts | 4 +++ 7 files changed, 55 insertions(+), 8 deletions(-) diff --git a/android/snapshot-helper/src/main/java/com/callstack/agentdevice/snapshothelper/AccessibilityTreeXml.java b/android/snapshot-helper/src/main/java/com/callstack/agentdevice/snapshothelper/AccessibilityTreeXml.java index 334fcaf115..1ce5be840a 100644 --- a/android/snapshot-helper/src/main/java/com/callstack/agentdevice/snapshothelper/AccessibilityTreeXml.java +++ b/android/snapshot-helper/src/main/java/com/callstack/agentdevice/snapshothelper/AccessibilityTreeXml.java @@ -61,6 +61,9 @@ static void appendNode( appendAttribute(xml, "visible-to-user", Boolean.toString(node.isVisibleToUser())); appendDrawingOrderAttribute(xml, node); appendTrueAttribute(xml, "clickable", node.isClickable()); + // Both answers, like `selected` below: a helper older than this attribute reports nothing, and + // the host keeps that apart from a node that offers no long click. + appendAttribute(xml, "long-clickable", Boolean.toString(node.isLongClickable())); appendAttribute(xml, "enabled", Boolean.toString(node.isEnabled())); appendTrueAttribute(xml, "focusable", node.isFocusable()); appendTrueAttribute(xml, "focused", node.isFocused()); @@ -188,8 +191,6 @@ private static boolean isHeading(AccessibilityNodeInfo node) { return Build.VERSION.SDK_INT >= Build.VERSION_CODES.P && node.isHeading(); } - // Declared residue (agent-device #1832): long-clickable is not serialized. Adding it is a helper - // protocol change (new attribute + host parser + field on the wire node). private static void appendDrawingOrderAttribute(StringBuilder xml, AccessibilityNodeInfo node) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { appendAttribute(xml, "drawing-order", Integer.toString(node.getDrawingOrder())); diff --git a/packages/command-runtime/src/commands/capture/runtime/snapshot-unchanged.ts b/packages/command-runtime/src/commands/capture/runtime/snapshot-unchanged.ts index 7d293b61d8..b71f23dc82 100644 --- a/packages/command-runtime/src/commands/capture/runtime/snapshot-unchanged.ts +++ b/packages/command-runtime/src/commands/capture/runtime/snapshot-unchanged.ts @@ -131,6 +131,10 @@ const PRESENTATION_SCALAR_FIELDS = { roleDescription: true, placeholder: true, hittable: true, + clickable: true, + focusable: true, + longClickable: true, + scrollable: true, bundleId: true, systemBar: true, appName: true, diff --git a/packages/kernel/src/snapshot.ts b/packages/kernel/src/snapshot.ts index e8dc06b0c0..53fc01e3bc 100644 --- a/packages/kernel/src/snapshot.ts +++ b/packages/kernel/src/snapshot.ts @@ -333,6 +333,19 @@ export type RawSnapshotNode = { /** UIKit `isUserInteractionEnabled`; absent means the producer did not read it, not false. */ userInteractionEnabled?: boolean; hittable?: boolean; + /** + * Android accessibility facts behind `hittable`, each on its own: `hittable` answers "can an + * agent drive this node" and folds a touch target and a focus target into one, while a reader + * that audits what an accessibility service is offered needs them apart. `clickable` is what a + * screen reader activates, `focusable` is what input focus can land on, `longClickable` is what + * it offers a long press on, and `scrollable` is a container announced as one. Absent means the + * producer did not read the fact, not false; `longClickable` is absent on a capture from an + * Android helper older than the attribute. + */ + clickable?: boolean; + focusable?: boolean; + longClickable?: boolean; + scrollable?: boolean; depth?: number; parentIndex?: number; pid?: number; diff --git a/packages/platform-android/src/__tests__/snapshot-clickability.test.ts b/packages/platform-android/src/__tests__/snapshot-clickability.test.ts index 63b979b7dd..e64926901a 100644 --- a/packages/platform-android/src/__tests__/snapshot-clickability.test.ts +++ b/packages/platform-android/src/__tests__/snapshot-clickability.test.ts @@ -42,9 +42,9 @@ afterEach(() => { test('retains Android helper clickable facts from the same hierarchy projection', () => { const built = buildUiHierarchySnapshot( parseUiHierarchyTree(` - - - + + + `), undefined, { raw: true }, @@ -63,11 +63,27 @@ test('retains Android helper clickable facts from the same hierarchy projection' ], ); assert.equal(publicSnapshot.nodes[1]?.hittable, true); - assert.equal('clickable' in (publicSnapshot.nodes[1] ?? {}), false); + // The facts `hittable` folds together are published each on its own. A focusable node that is + // not clickable is hittable, and only the separate facts tell it from a touch target. + assert.deepEqual( + publicSnapshot.nodes.map((node) => [node.clickable, node.focusable, node.scrollable]), + [ + [true, false, false], + [false, true, false], + [false, false, true], + ], + ); + // Both answers when the capture reported one, and nothing when it did not: a helper older than + // the attribute is not read as "offers no long click". + assert.deepEqual( + publicSnapshot.nodes.map((node) => node.longClickable), + [true, false, undefined], + ); + assert.equal('longClickable' in (publicSnapshot.nodes[2] ?? {}), false); assert.equal(readSnapshotClickabilityEvidence(publicSnapshot), undefined); }); -test('snapshotAndroid captures the hierarchy once and retains clickability off-wire', async () => { +test('snapshotAndroid captures the hierarchy once and publishes the clickability it retains', async () => { let hierarchyCaptures = 0; const helperAdb: AndroidAdbExecutor = async (args) => { if (args.includes('--show-versioncode')) { @@ -119,7 +135,10 @@ test('snapshotAndroid captures the hierarchy once and retains clickability off-w [2, 2], ], ); - assert.equal(JSON.stringify(result).includes('clickable'), false); + assert.deepEqual( + result.nodes.map((node) => node.clickable), + [false, true, false], + ); assert.equal(JSON.stringify(result).includes('sourceIndexByNodeIndex'), false); }); diff --git a/packages/platform-android/src/ui-hierarchy-builder.ts b/packages/platform-android/src/ui-hierarchy-builder.ts index 2821885b39..bde92fdc5d 100644 --- a/packages/platform-android/src/ui-hierarchy-builder.ts +++ b/packages/platform-android/src/ui-hierarchy-builder.ts @@ -478,6 +478,10 @@ function createAndroidRawSnapshotNode( focused: node.focused, visibleToUser: node.visibleToUser, hittable: isAgentTarget(node) || undefined, + clickable: node.clickable, + focusable: node.focusable, + ...(node.longClickable === undefined ? {} : { longClickable: node.longClickable }), + scrollable: node.scrollable === true, depth: compactedAndroidNodeDepth(state.nodes, parentIndex), parentIndex, ...androidScrollActionHints(node, state.hidden), diff --git a/packages/platform-android/src/ui-hierarchy-node.ts b/packages/platform-android/src/ui-hierarchy-node.ts index 34197445dc..b41f18da24 100644 --- a/packages/platform-android/src/ui-hierarchy-node.ts +++ b/packages/platform-android/src/ui-hierarchy-node.ts @@ -37,6 +37,8 @@ export type AndroidUiHierarchy = { // encodings of one control opposite answers. clickable: boolean; focusable: boolean; + /** Whether the node offers a long click. Absent when the capture did not report it. */ + longClickable?: boolean; depth: number; parentIndex?: number; scrollable?: boolean; diff --git a/packages/platform-android/src/ui-hierarchy.ts b/packages/platform-android/src/ui-hierarchy.ts index 7ef9b77d94..fc82b9998e 100644 --- a/packages/platform-android/src/ui-hierarchy.ts +++ b/packages/platform-android/src/ui-hierarchy.ts @@ -30,6 +30,8 @@ export type AndroidUiNodeMetadata = { bounds: string | null; rect?: Rect; clickable?: boolean; + /** Absent when the capture did not report it: a helper older than the attribute. */ + longClickable?: boolean; enabled?: boolean; visibleToUser?: boolean; drawingOrder?: number; @@ -166,6 +168,7 @@ function readNodeAttributes(node: string): Omit { className: getAttr('class'), bounds: getAttr('bounds'), clickable: boolAttr('clickable'), + ...optionalBoolAttr('longClickable', 'long-clickable'), enabled: boolAttr('enabled'), focusable: boolAttr('focusable'), focused: boolAttr('focused'), @@ -350,6 +353,7 @@ function normalizeAndroidUiHierarchyNode( focused: attrs.focused, visibleToUser: attrs.visibleToUser, clickable: attrs.clickable === true, + longClickable: attrs.longClickable, focusable: attrs.focusable === true, scrollable: attrs.scrollable, canScrollForward: attrs.canScrollForward, From d56b15a98d26aa71e6fcc90a68c5b9f31e4d77dc Mon Sep 17 00:00:00 2001 From: dannyhw Date: Tue, 17 Nov 2026 11:51:11 +0000 Subject: [PATCH 2/9] chore(android): drop the comments added with the snapshot facts --- .../agentdevice/snapshothelper/AccessibilityTreeXml.java | 2 -- packages/kernel/src/snapshot.ts | 9 --------- .../src/__tests__/snapshot-clickability.test.ts | 4 ---- packages/platform-android/src/ui-hierarchy-node.ts | 1 - packages/platform-android/src/ui-hierarchy.ts | 1 - 5 files changed, 17 deletions(-) diff --git a/android/snapshot-helper/src/main/java/com/callstack/agentdevice/snapshothelper/AccessibilityTreeXml.java b/android/snapshot-helper/src/main/java/com/callstack/agentdevice/snapshothelper/AccessibilityTreeXml.java index 1ce5be840a..31c3a11db1 100644 --- a/android/snapshot-helper/src/main/java/com/callstack/agentdevice/snapshothelper/AccessibilityTreeXml.java +++ b/android/snapshot-helper/src/main/java/com/callstack/agentdevice/snapshothelper/AccessibilityTreeXml.java @@ -61,8 +61,6 @@ static void appendNode( appendAttribute(xml, "visible-to-user", Boolean.toString(node.isVisibleToUser())); appendDrawingOrderAttribute(xml, node); appendTrueAttribute(xml, "clickable", node.isClickable()); - // Both answers, like `selected` below: a helper older than this attribute reports nothing, and - // the host keeps that apart from a node that offers no long click. appendAttribute(xml, "long-clickable", Boolean.toString(node.isLongClickable())); appendAttribute(xml, "enabled", Boolean.toString(node.isEnabled())); appendTrueAttribute(xml, "focusable", node.isFocusable()); diff --git a/packages/kernel/src/snapshot.ts b/packages/kernel/src/snapshot.ts index 53fc01e3bc..688a876360 100644 --- a/packages/kernel/src/snapshot.ts +++ b/packages/kernel/src/snapshot.ts @@ -333,15 +333,6 @@ export type RawSnapshotNode = { /** UIKit `isUserInteractionEnabled`; absent means the producer did not read it, not false. */ userInteractionEnabled?: boolean; hittable?: boolean; - /** - * Android accessibility facts behind `hittable`, each on its own: `hittable` answers "can an - * agent drive this node" and folds a touch target and a focus target into one, while a reader - * that audits what an accessibility service is offered needs them apart. `clickable` is what a - * screen reader activates, `focusable` is what input focus can land on, `longClickable` is what - * it offers a long press on, and `scrollable` is a container announced as one. Absent means the - * producer did not read the fact, not false; `longClickable` is absent on a capture from an - * Android helper older than the attribute. - */ clickable?: boolean; focusable?: boolean; longClickable?: boolean; diff --git a/packages/platform-android/src/__tests__/snapshot-clickability.test.ts b/packages/platform-android/src/__tests__/snapshot-clickability.test.ts index e64926901a..2fb76af056 100644 --- a/packages/platform-android/src/__tests__/snapshot-clickability.test.ts +++ b/packages/platform-android/src/__tests__/snapshot-clickability.test.ts @@ -63,8 +63,6 @@ test('retains Android helper clickable facts from the same hierarchy projection' ], ); assert.equal(publicSnapshot.nodes[1]?.hittable, true); - // The facts `hittable` folds together are published each on its own. A focusable node that is - // not clickable is hittable, and only the separate facts tell it from a touch target. assert.deepEqual( publicSnapshot.nodes.map((node) => [node.clickable, node.focusable, node.scrollable]), [ @@ -73,8 +71,6 @@ test('retains Android helper clickable facts from the same hierarchy projection' [false, false, true], ], ); - // Both answers when the capture reported one, and nothing when it did not: a helper older than - // the attribute is not read as "offers no long click". assert.deepEqual( publicSnapshot.nodes.map((node) => node.longClickable), [true, false, undefined], diff --git a/packages/platform-android/src/ui-hierarchy-node.ts b/packages/platform-android/src/ui-hierarchy-node.ts index b41f18da24..1c41ad673a 100644 --- a/packages/platform-android/src/ui-hierarchy-node.ts +++ b/packages/platform-android/src/ui-hierarchy-node.ts @@ -37,7 +37,6 @@ export type AndroidUiHierarchy = { // encodings of one control opposite answers. clickable: boolean; focusable: boolean; - /** Whether the node offers a long click. Absent when the capture did not report it. */ longClickable?: boolean; depth: number; parentIndex?: number; diff --git a/packages/platform-android/src/ui-hierarchy.ts b/packages/platform-android/src/ui-hierarchy.ts index fc82b9998e..308c0deb06 100644 --- a/packages/platform-android/src/ui-hierarchy.ts +++ b/packages/platform-android/src/ui-hierarchy.ts @@ -30,7 +30,6 @@ export type AndroidUiNodeMetadata = { bounds: string | null; rect?: Rect; clickable?: boolean; - /** Absent when the capture did not report it: a helper older than the attribute. */ longClickable?: boolean; enabled?: boolean; visibleToUser?: boolean; From ac589490f5322cd4d838d500983786798d42e081 Mon Sep 17 00:00:00 2001 From: dannyhw Date: Tue, 17 Nov 2026 13:19:20 +0000 Subject: [PATCH 3/9] feat(android): publish the clickability facts on raw snapshot nodes only clickable, focusable, longClickable and scrollable now travel as passive facts, so the raw projection carries them without new builder lines and longClickable drops out when the helper did not report it. The regular serializer omits all four, which keeps default snapshot --json unchanged: on a 500-node screen they would add tens of KB of mostly-false keys. Publishing them by default is a matter of removing that omission. A regular-projection case pins what the default route publishes for a visible and a fully clipped row. --- .../__tests__/snapshot-clickability.test.ts | 38 ++++++++++++++++++- .../src/snapshot-presentation-node.ts | 9 ++++- .../src/ui-hierarchy-builder.ts | 4 -- .../platform-android/src/ui-hierarchy-node.ts | 5 ++- packages/platform-android/src/ui-hierarchy.ts | 5 ++- 5 files changed, 53 insertions(+), 8 deletions(-) diff --git a/packages/platform-android/src/__tests__/snapshot-clickability.test.ts b/packages/platform-android/src/__tests__/snapshot-clickability.test.ts index 2fb76af056..e7dbb37b42 100644 --- a/packages/platform-android/src/__tests__/snapshot-clickability.test.ts +++ b/packages/platform-android/src/__tests__/snapshot-clickability.test.ts @@ -75,10 +75,46 @@ test('retains Android helper clickable facts from the same hierarchy projection' publicSnapshot.nodes.map((node) => node.longClickable), [true, false, undefined], ); - assert.equal('longClickable' in (publicSnapshot.nodes[2] ?? {}), false); + assert.equal(JSON.stringify(publicSnapshot.nodes[2]).includes('longClickable'), false); assert.equal(readSnapshotClickabilityEvidence(publicSnapshot), undefined); }); +test('the regular projection keeps the clickability facts off the node', () => { + const built = buildUiHierarchySnapshot( + parseUiHierarchyTree(` + + + + + `), + undefined, + {}, + ); + const evidence = buildAndroidSnapshotClickabilityEvidence(built); + if (evidence.kind !== 'exact') throw new Error('Android evidence must be exact'); + + assert.deepEqual( + built.nodes.map((node) => [node.identifier, node.hittable]), + [ + ['list', undefined], + ['visible-row', true], + ], + ); + assert.deepEqual( + built.nodes.map((node) => + ['clickable', 'focusable', 'longClickable', 'scrollable'].filter((key) => key in node), + ), + [[], []], + ); + assert.deepEqual( + [...evidence.clickableByNodeIndex.entries()], + [ + [0, false], + [1, true], + ], + ); +}); + test('snapshotAndroid captures the hierarchy once and publishes the clickability it retains', async () => { let hierarchyCaptures = 0; const helperAdb: AndroidAdbExecutor = async (args) => { diff --git a/packages/platform-android/src/snapshot-presentation-node.ts b/packages/platform-android/src/snapshot-presentation-node.ts index c015fb0a22..0e63106c11 100644 --- a/packages/platform-android/src/snapshot-presentation-node.ts +++ b/packages/platform-android/src/snapshot-presentation-node.ts @@ -48,8 +48,15 @@ export function foldSnapshotRect( export function serializeRegularSnapshotPresentationNode( node: SnapshotPresentationNode, ): RawSnapshotNode { + const { + clickable: _clickable, + focusable: _focusable, + longClickable: _longClickable, + scrollable: _scrollable, + ...published + } = node.raw; return { - ...node.raw, + ...published, ...(node.effectiveRect ? { rect: node.effectiveRect } : { rect: undefined }), hittable: node.raw.hittable === true && isPositiveFiniteRect(node.effectiveRect) ? true : undefined, diff --git a/packages/platform-android/src/ui-hierarchy-builder.ts b/packages/platform-android/src/ui-hierarchy-builder.ts index bde92fdc5d..2821885b39 100644 --- a/packages/platform-android/src/ui-hierarchy-builder.ts +++ b/packages/platform-android/src/ui-hierarchy-builder.ts @@ -478,10 +478,6 @@ function createAndroidRawSnapshotNode( focused: node.focused, visibleToUser: node.visibleToUser, hittable: isAgentTarget(node) || undefined, - clickable: node.clickable, - focusable: node.focusable, - ...(node.longClickable === undefined ? {} : { longClickable: node.longClickable }), - scrollable: node.scrollable === true, depth: compactedAndroidNodeDepth(state.nodes, parentIndex), parentIndex, ...androidScrollActionHints(node, state.hidden), diff --git a/packages/platform-android/src/ui-hierarchy-node.ts b/packages/platform-android/src/ui-hierarchy-node.ts index 1c41ad673a..c35267dec3 100644 --- a/packages/platform-android/src/ui-hierarchy-node.ts +++ b/packages/platform-android/src/ui-hierarchy-node.ts @@ -16,6 +16,10 @@ type AndroidPassiveNodeFacts = Pick< | 'placeholder' | 'selectionStart' | 'selectionEnd' + | 'clickable' + | 'focusable' + | 'longClickable' + | 'scrollable' >; /** @@ -37,7 +41,6 @@ export type AndroidUiHierarchy = { // encodings of one control opposite answers. clickable: boolean; focusable: boolean; - longClickable?: boolean; depth: number; parentIndex?: number; scrollable?: boolean; diff --git a/packages/platform-android/src/ui-hierarchy.ts b/packages/platform-android/src/ui-hierarchy.ts index 308c0deb06..17741376f5 100644 --- a/packages/platform-android/src/ui-hierarchy.ts +++ b/packages/platform-android/src/ui-hierarchy.ts @@ -345,6 +345,10 @@ function normalizeAndroidUiHierarchyNode( placeholder: attrs.hint, selectionStart: attrs.selectionStart, selectionEnd: attrs.selectionEnd, + clickable: attrs.clickable === true, + focusable: attrs.focusable === true, + longClickable: attrs.longClickable, + scrollable: attrs.scrollable === true, }, identifier: attrs.resourceId, packageName: attrs.packageName, @@ -352,7 +356,6 @@ function normalizeAndroidUiHierarchyNode( focused: attrs.focused, visibleToUser: attrs.visibleToUser, clickable: attrs.clickable === true, - longClickable: attrs.longClickable, focusable: attrs.focusable === true, scrollable: attrs.scrollable, canScrollForward: attrs.canScrollForward, From 42bf6fd640bf390c06eb2f914037f70efbca2299 Mon Sep 17 00:00:00 2001 From: dannyhw Date: Tue, 17 Nov 2026 13:19:41 +0000 Subject: [PATCH 4/9] docs(snapshot): make the clickability comments match what nodes carry The private evidence comment now says raw Android nodes serialize clickable, and the freshness signature comment no longer says the helper serializes no long-clickable. --- .../capture-kit/src/snapshot/snapshot-freshness/android.ts | 4 ++-- packages/contracts/src/snapshot-private-evidence.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/capture-kit/src/snapshot/snapshot-freshness/android.ts b/packages/capture-kit/src/snapshot/snapshot-freshness/android.ts index b843ace5e4..07c5507c6e 100644 --- a/packages/capture-kit/src/snapshot/snapshot-freshness/android.ts +++ b/packages/capture-kit/src/snapshot/snapshot-freshness/android.ts @@ -45,8 +45,8 @@ export function isNavigationSensitiveAction(command: string): boolean { /** * Route signature of an Android snapshot, from the fields the Android backend actually carries. - * The helper serializes no `role` or `long-clickable` (declared residue, #1832), so a signature - * keying on them would compare constants and claim discrimination it does not have. `selected` + * The helper serializes no `role` (declared residue, #1832), so a signature keying on it + * would compare constants and claim discrimination it does not have. `selected` * and `checked` are left out as a judgement call rather than an inability: a tab-bar tap flips * selection on two nodes and a toggle tap flips one checked state, which the 90%-identical * threshold below absorbs at every tree size this check runs on, so keying on them would only add diff --git a/packages/contracts/src/snapshot-private-evidence.ts b/packages/contracts/src/snapshot-private-evidence.ts index 85ca60ad03..5ffe0860fd 100644 --- a/packages/contracts/src/snapshot-private-evidence.ts +++ b/packages/contracts/src/snapshot-private-evidence.ts @@ -3,8 +3,8 @@ import type { IosViewportEvidence } from './ios-snapshot.ts'; /** * Capture-local clickability facts for consumers that reproduce Maestro's private - * TreeNode semantics. This is deliberately kept outside SnapshotNode: the fact - * is retained by object identity, never serialized into the snapshot contract. + * TreeNode semantics. This is deliberately kept outside the regular SnapshotNode: + * the fact is retained by object identity, and only raw Android nodes serialize it. */ export type SnapshotClickabilityEvidence = | { From c574eeb41b6c0f59bc29db3364a8829bbe13b071 Mon Sep 17 00:00:00 2001 From: dannyhw Date: Tue, 17 Nov 2026 13:20:00 +0000 Subject: [PATCH 5/9] feat(daemon): keep the clickability facts in the attrs digest They are field facts whose explicit false is the signal, the rule the digest already follows for editable and checked. A regular node carries none of them, so the digest is unchanged there; a raw node keeps what it reported, and the list needs no change if they are later published by default. --- .../src/server/__tests__/response-views.test.ts | 11 +++++++++++ packages/daemon/src/server/response-views.ts | 4 ++++ 2 files changed, 15 insertions(+) diff --git a/packages/daemon/src/server/__tests__/response-views.test.ts b/packages/daemon/src/server/__tests__/response-views.test.ts index fe71297fb4..ee14ff8570 100644 --- a/packages/daemon/src/server/__tests__/response-views.test.ts +++ b/packages/daemon/src/server/__tests__/response-views.test.ts @@ -377,6 +377,17 @@ test('attrs digest carries both checked answers, and none for a node that cannot expect('checked' in plain).toBe(false); }); +test('attrs digest carries the clickability facts a raw node reports, and none it does not', () => { + const facts = { clickable: false, focusable: true, longClickable: false, scrollable: false }; + const digest = getView!({ ref: 'e7', node: { ...MATCHED_NODE, ...facts } }, 'digest'); + expect(digest.node).toEqual({ ...COMPACT_NODE, ...facts }); + const plain = getView!({ ref: 'e7', node: MATCHED_NODE }, 'digest').node as Record< + string, + unknown + >; + for (const field of Object.keys(facts)) expect(field in plain).toBe(false); +}); + test('find/get default and full return today’s shape unchanged (same reference)', () => { const data: DaemonResponseData = { ref: '@e7', text: 'Sign in', node: MATCHED_NODE }; expect(findView!(data, 'default')).toBe(data); diff --git a/packages/daemon/src/server/response-views.ts b/packages/daemon/src/server/response-views.ts index 8f9a9e2319..5d47383dc2 100644 --- a/packages/daemon/src/server/response-views.ts +++ b/packages/daemon/src/server/response-views.ts @@ -133,6 +133,10 @@ const SELECTOR_DIGEST_NODE_FIELDS = [ 'selectionStart', 'selectionEnd', 'hittable', + 'clickable', + 'focusable', + 'longClickable', + 'scrollable', ] as const; function compactSelectorNode(node: SnapshotNode): Record { From a45435dfa351fc116cd476596e6f6a6bf7ed711d Mon Sep 17 00:00:00 2001 From: dannyhw Date: Tue, 17 Nov 2026 13:20:13 +0000 Subject: [PATCH 6/9] docs(snapshots): describe the interaction facts on raw Android nodes --- website/docs/docs/snapshots.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/website/docs/docs/snapshots.md b/website/docs/docs/snapshots.md index 2d9b37df26..5990947aab 100644 --- a/website/docs/docs/snapshots.md +++ b/website/docs/docs/snapshots.md @@ -308,6 +308,13 @@ decides which backends it tries. to conservative behavior there, and `androidSnapshot.occlusionScanUnavailable: true` tells you so. - `--raw` returns the tree as captured. It also keeps nodes Android marks invisible and stale application windows. +- `--raw` nodes carry four interaction facts that default and `-i` snapshots leave out. An absent + field means the capture could not read it, not `false`: + - `clickable`: the node accepts a tap. + - `focusable`: keyboard or D-pad focus can land on the node. + - `longClickable`: the node accepts a long press. Absent when an older snapshot helper served the + capture. + - `scrollable`: the node scrolls its content. ## iOS node metadata From af7dd7344723ecf29f87b81f4fceeca6650a8ec8 Mon Sep 17 00:00:00 2001 From: dannyhw Date: Tue, 17 Nov 2026 13:20:43 +0000 Subject: [PATCH 7/9] test(android): pin both long-clickable answers in the helper suite The helper writes long-clickable through a package-level method so its own suite, which runs without the Android runtime, can assert true and false. --- .../snapshothelper/AccessibilityTreeXml.java | 6 +++++- .../snapshothelper/AccessibilityTreeXmlTest.java | 10 ++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/android/snapshot-helper/src/main/java/com/callstack/agentdevice/snapshothelper/AccessibilityTreeXml.java b/android/snapshot-helper/src/main/java/com/callstack/agentdevice/snapshothelper/AccessibilityTreeXml.java index 31c3a11db1..bc2f5ad3c5 100644 --- a/android/snapshot-helper/src/main/java/com/callstack/agentdevice/snapshothelper/AccessibilityTreeXml.java +++ b/android/snapshot-helper/src/main/java/com/callstack/agentdevice/snapshothelper/AccessibilityTreeXml.java @@ -61,7 +61,7 @@ static void appendNode( appendAttribute(xml, "visible-to-user", Boolean.toString(node.isVisibleToUser())); appendDrawingOrderAttribute(xml, node); appendTrueAttribute(xml, "clickable", node.isClickable()); - appendAttribute(xml, "long-clickable", Boolean.toString(node.isLongClickable())); + appendLongClickableAttribute(xml, node.isLongClickable()); appendAttribute(xml, "enabled", Boolean.toString(node.isEnabled())); appendTrueAttribute(xml, "focusable", node.isFocusable()); appendTrueAttribute(xml, "focused", node.isFocused()); @@ -218,6 +218,10 @@ private static void appendAttribute(StringBuilder xml, String name, CharSequence xml.append('"'); } + static void appendLongClickableAttribute(StringBuilder xml, boolean longClickable) { + appendAttribute(xml, "long-clickable", Boolean.toString(longClickable)); + } + static void appendBoundsAttribute( StringBuilder xml, String name, int left, int top, int right, int bottom) { xml.append(' ').append(name).append("=\"[") diff --git a/android/snapshot-helper/src/test/java/com/callstack/agentdevice/snapshothelper/AccessibilityTreeXmlTest.java b/android/snapshot-helper/src/test/java/com/callstack/agentdevice/snapshothelper/AccessibilityTreeXmlTest.java index 1b00898018..8aec97b2cf 100644 --- a/android/snapshot-helper/src/test/java/com/callstack/agentdevice/snapshothelper/AccessibilityTreeXmlTest.java +++ b/android/snapshot-helper/src/test/java/com/callstack/agentdevice/snapshothelper/AccessibilityTreeXmlTest.java @@ -8,6 +8,16 @@ static void run() { assertBounds( "window-bounds", Integer.MIN_VALUE, -1, 0, Integer.MAX_VALUE, " window-bounds=\"[-2147483648,-1][0,2147483647]\""); + assertLongClickable(true, " long-clickable=\"true\""); + assertLongClickable(false, " long-clickable=\"false\""); + } + + private static void assertLongClickable(boolean longClickable, String expected) { + StringBuilder xml = new StringBuilder(); + AccessibilityTreeXml.appendLongClickableAttribute(xml, longClickable); + if (!expected.equals(xml.toString())) { + throw new AssertionError("Expected " + expected + ", got " + xml); + } } private static void assertBounds( From 4451103ee4e019ad5dcc0fc939c6f97257fee24d Mon Sep 17 00:00:00 2001 From: dannyhw Date: Tue, 17 Nov 2026 13:32:01 +0000 Subject: [PATCH 8/9] docs(android): say which passive facts the regular projection leaves out --- packages/platform-android/src/ui-hierarchy-node.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/platform-android/src/ui-hierarchy-node.ts b/packages/platform-android/src/ui-hierarchy-node.ts index c35267dec3..0a98438031 100644 --- a/packages/platform-android/src/ui-hierarchy-node.ts +++ b/packages/platform-android/src/ui-hierarchy-node.ts @@ -1,6 +1,9 @@ import type { RawSnapshotNode, Rect } from '@agent-device/kernel/snapshot'; -/** Normalized attributes carried unchanged into the public node, independent of presentation. */ +/** + * Normalized attributes carried unchanged into the public node, independent of presentation. + * The regular projection leaves out `clickable`, `focusable`, `longClickable` and `scrollable`. + */ type AndroidPassiveNodeFacts = Pick< RawSnapshotNode, | 'contentDescription' From c0587e9c4cf6bbbb4a279c3fd9fdf15bf0c59123 Mon Sep 17 00:00:00 2001 From: dannyhw Date: Tue, 17 Nov 2026 14:02:27 +0000 Subject: [PATCH 9/9] chore: re-run checks