Skip to content

feat(audit): evaluate role-less clickable views on Android - #4780

Merged
thymikee merged 3 commits into
mainfrom
feat/audit-android-roleless-clickables
Nov 20, 2026
Merged

thymikee merged 3 commits into
mainfrom
feat/audit-android-roleless-clickables

Conversation

@thymikee

@thymikee thymikee commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Summary

audit recognized Android controls only by role, so a role-less clickable or long-clickable view (a React Native Pressable without accessibilityRole) produced no small-target and no missing-name finding. The audit now folds the helper's retained clickability evidence back onto the captured nodes and evaluates such a node as a clickable control. A clickable container whose only actionable descendant is already a control reports once, on the container. iOS is unchanged. commands.md no longer says generic clickable containers on Android are not evaluated, and the audit help states the new rule. 8 files. No scope expansion. Closes #4759

Validation

Head 2d48b3bdc0.

  • Gate: pnpm check:affected --run — all runnable checks passed, exactCommit=true. Coverage, provider integration, and device lanes are CI obligations.
  • Focused vitest: capture-kit, platform-android, command-surface, command-runtime capture — 330 files / 3084 tests passed. New tests cover the 30dp role-less clickable, the unnamed long-clickable, and the container-wrapping-a-button collapse.
  • Live evidence: emulator-5554 (Pixel_7_CI, Android 16), branch-built node bin/agent-device.mjs, session roleless. snapshot -i --json shows androidSnapshot.backend=android-helper, helperVersion=0.21.42-dev, density 2.625. audit --json on the dev-client launcher reports small-target role=clickable for INFO (38.5x32dp) and RESET (41.9x48dp); the snapshot captures both as role-less android.widget.TextView, so neither reported before this change. Raw outputs saved under .tmp/evidence/.
  • Limitation: the installed com.callstack.agentdevicelab dev client crashes on this checkout's Metro bundle (gesture-handler v3 binding mismatch), so the lab app screens were unreachable; the dev-client launcher provided the role-less clickables instead.

Audited screen


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

View guided diff Turn on auto-fix

Android nodes the helper reports as clickable or long-clickable with no
control role (a React Native Pressable without an accessibilityRole) are
now evaluated as controls for small-target and missing-name. A clickable
container whose only actionable descendant is already a control reports
once, on the container, following the same-role child rule. iOS is
unchanged. The audit folds the helper's retained clickability evidence
back onto the published nodes, since regular Android snapshots omit the
raw tap facts.

Closes #4759
@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Size Report

Metric Base Current Diff
Installed (including dependencies) 6.43 MB 6.43 MB +1.6 kB
Package (unpacked) 6.43 MB 6.43 MB +1.6 kB
Package (download) 1.95 MB 1.95 MB +538 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 31.2 ms 40.2 ms +8.9 ms
CLI --help 60.3 ms 68.9 ms +8.6 ms

@apex-sentinel-staging

This comment has been minimized.

@apex-sentinel-staging apex-sentinel-staging Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apex Sentinel: 1 new finding on 2d48b3b. The verdict and the full list are in the summary comment.

@thymikee

Copy link
Copy Markdown
Member Author

Thanks for this. At 2d48b3b there are three problems to fix before merge. CI is green (20 checks, 0 not passing) and there are no conflicts.

The covered-control pass still ignores role-less clickables. coveredRole resolves roles with controlRole only, while evaluateControl and auditNode now use auditRole. An Android clickable without a role (for example an RN Pressable without accessibilityRole) that the occlusion pass marks covered is skipped by isActionable and gets no covered-control finding. The help text and commands.md say such a node is evaluated as a control too, so an agent will read a silent audit as "nothing covered" when a custom touchable sits under a sheet or bar. The rule: every audit pass resolves a node's role through auditRole. Please make coveredRole use the facts that coveredFinding and isOnlyChildOfReportedCover already receive, and add a test with a covered clickable android.view.View. Alternatively, limit the help and doc sentence to the size, name and shared-name checks.

The tests do not cover the route production uses. Every new test in snapshot-audit.test.ts passes clickable/longClickable on the node itself. On real Android captures those fields are stripped, and only auditSnapshotState through withRetainedTapFacts (snapshot-audit.ts:142-161) restores them from the retained evidence. If withRetainedTapFacts returned snapshot.nodes unchanged, all tests would stay green while the feature is dead on device. Please add a capture-kit test that builds a SnapshotState with no clickable on its nodes, attaches exact android-helper evidence with attachSnapshotClickabilityEvidence (both maps), and asserts that auditSnapshotState reports a small-target finding with role clickable. Add a second case with no evidence, or with divergence evidence, that asserts no finding.

Shared-name findings are likely wrong for clickable containers. A role-less clickable container is named from its first named descendant (accessibleName), but TalkBack announces such a container by joining its descendants' text. Two feed cards or list rows with the same first text child (an author, "Sponsored", a repeated title) get the same name, land in one clickable group, and each gets ambiguous-name even though the announced names differ. The issue scoped these nodes to small-target and missing-name. The rule: a shared-name finding compares the name the screen reader announces. The smallest fix is to skip ambiguous-name for the Android touchable role and say so in the help and commands.md. Missing-name stays correct, since any named descendant suffices. Please add a two-row test where the rows share a first child and differ in the second.

The open inline thread on coveredRole (#4780 (comment)) still stands and is the same problem as the first finding above.

Not blocking, and you can take or leave these: make longClickableByNodeIndex required in snapshot-private-evidence.ts and drop the optional chain, since its only producer always sets it; add a clause to commands.md and the help that these nodes report role clickable, which the snapshot itself never shows; and change the cliDetail text in capture/snapshot.ts to say the container reports the control once "for each finding kind the container reports itself", because a named container with an unnamed Button child still yields missing-name on the child.

Please attach the raw live output (backend and the two small-target findings). The live run covered only small-target on role-less TextViews in the dev-client launcher. Missing-name, the container collapse, and list-row or whole-screen wrappers (for example RN TouchableWithoutFeedback keyboard-dismiss roots, clickable RecyclerView rows) were not run on a device, and the TalkBack joining behavior is not reproduced on device.

Before merge: route coveredRole through auditRole (or narrow the doc sentence), add the auditSnapshotState test that goes through the retained evidence, and stop ambiguous-name from comparing first-child names of role-less clickable containers.

Route coveredRole through auditRole so a covered role-less Android touchable
gets its covered-control finding. Exclude the role-less clickable role from
the shared-name count: its name comes from its first named descendant while
TalkBack joins every descendant's text, so two rows with an equal first child
announce different names. Make longClickableByNodeIndex required on the exact
android-helper evidence, the shape its only producer always writes. Document
the clickable role and the shared-name exclusion in the audit help, cliDetail,
and commands.md, and word the container collapse per finding kind.
@thymikee

Copy link
Copy Markdown
Member Author

Pushed 09d27215bd. Addressed the three blocking findings and the non-blocking items. pnpm check:affected --run passes on the head commit.

1. coveredRole now routes through auditRole (snapshot-audit.ts). Before: with the fix reverted, the new covered role-less clickable test failed (a covered android.view.View with clickable: true got no covered-control finding). After: it passes, with role clickable. The covered pass, evaluateControl, and auditNode now resolve every node's role through the same resolver, so the help and commands.md sentence holds for the covered pass too.

2. Added the auditSnapshotState tests that go through the retained evidence. One test builds a SnapshotState whose nodes carry no clickable, attaches exact android-helper evidence with attachSnapshotClickabilityEvidence (both maps), and asserts auditSnapshotState reports a small-target finding with role clickable. A second case attaches no evidence and a third attaches divergence evidence; both assert no findings. Fail-before: with withRetainedTapFacts stubbed to return snapshot.nodes unchanged, the exact-evidence test fails and the other two pass. Pass-after: all three pass.

3. ambiguous-name no longer compares role-less clickable containers. The shared-name count skips the clickable role: accessibleName reads the first named descendant, while TalkBack joins every descendant's text, so a shared first child proves nothing. New test: two feed rows whose first child text is both "Sponsored" and whose second children differ get no ambiguous-name. Fail-before: with the skip removed, both rows get the false shared-name finding. Pass-after: no findings. missing-name stays as it was: any named descendant still satisfies it. Documented in commands.md and the audit description/cliDetail.

4. Live device output. Re-captured on emulator-5554 (host local) with the branch-built CLI (AGENT_DEVICE_STATE_DIR=$PWD/.tmp/ad-state node bin/agent-device.mjs ... --session roleless, helper artifact from pnpm build:android). Screen: the Expo dev launcher reached by open com.callstack.agentdevicelab. The audit reports INFO and RESET as small-target with role clickable. The matching snapshot shows those nodes as plain android.widget.TextView with no clickable field at all, which is the strip-and-restore route the new auditSnapshotState tests cover. The audit frame and the snapshot frame mint separate refs, so the excerpts are two captures of the same unchanged screen, matched by label and rect. Scope note as before: this run covers small-target on role-less clickables; missing-name on a role-less clickable, the container collapse, and TalkBack joining were not exercised on device.

Raw audit --json (role-less clickable findings: @e27 INFO, @e42 RESET)
{
  "success": true,
  "data": {
    "findings": [
      {
        "ref": "@e27",
        "rect": {
          "x": 916,
          "y": 483,
          "width": 101,
          "height": 84
        },
        "role": "clickable",
        "label": "INFO",
        "kind": "small-target",
        "severity": "warning",
        "detail": {
          "unit": "dp",
          "width": 38.5,
          "height": 32,
          "recommendedSize": 48
        }
      },
      {
        "ref": "@e32",
        "rect": {
          "x": 147,
          "y": 945,
          "width": 786,
          "height": 126
        },
        "role": "text-field",
        "kind": "missing-name",
        "severity": "warning"
      },
      {
        "ref": "@e42",
        "rect": {
          "x": 907,
          "y": 1586,
          "width": 110,
          "height": 126
        },
        "role": "clickable",
        "label": "RESET",
        "kind": "small-target",
        "severity": "warning",
        "detail": {
          "unit": "dp",
          "width": 41.9,
          "height": 48,
          "recommendedSize": 48
        }
      },
      {
        "ref": "@e44",
        "rect": {
          "x": 63,
          "y": 1711,
          "width": 954,
          "height": 185
        },
        "role": "button",
        "kind": "ambiguous-name",
        "severity": "warning",
        "detail": {
          "name": "Agent Device Tester",
          "count": 2
        }
      },
      {
        "ref": "@e49",
        "rect": {
          "x": 63,
          "y": 1907,
          "width": 954,
          "height": 170
        },
        "role": "button",
        "kind": "ambiguous-name",
        "severity": "warning",
        "detail": {
          "name": "Agent Device Tester",
          "count": 2
        }
      }
    ],
    "guidance": {
      "small-target": "Material recommends 48×48dp. Enlarge the touch area with padding, a minimum size, or hitSlop.",
      "missing-name": "Set an accessibility label (iOS accessibilityLabel, Android contentDescription, React Native accessibilityLabel).",
      "ambiguous-name": "Give each control a unique label that names its target, for example \"Save Lemon Herb Rice\"."
    },
    "checks": {
      "snapshot": "complete"
    },
    "limitations": [],
    "refsGeneration": 856251
  }
}
```json

</details>

<details>
<summary>Matching <code>snapshot -i --json</code> node excerpt (same screen; the two audited nodes carry no tap fact in the snapshot)</summary>

```json
{
  "androidSnapshot": {
    "backend": "android-helper",
    "pixelDensity": 2.625,
    "helperVersion": "0.21.42-dev"
  },
  "nodes": [
    {
      "index": 3,
      "type": "android.widget.TextView",
      "label": "INFO",
      "enabled": true,
      "selected": false,
      "editable": false,
      "password": false,
      "hintShowing": false,
      "bundleId": "com.callstack.agentdevicelab",
      "rect": {
        "x": 916,
        "y": 483,
        "width": 101,
        "height": 84
      },
      "visibleToUser": true,
      "hittable": true,
      "depth": 1,
      "parentIndex": 2,
      "ref": "e4",
      "kind": "text"
    },
    {
      "index": 11,
      "type": "android.widget.TextView",
      "label": "RESET",
      "enabled": true,
      "selected": false,
      "editable": false,
      "password": false,
      "hintShowing": false,
      "bundleId": "com.callstack.agentdevicelab",
      "rect": {
        "x": 907,
        "y": 1586,
        "width": 110,
        "height": 126
      },
      "visibleToUser": true,
      "hittable": true,
      "depth": 1,
      "parentIndex": 2,
      "ref": "e12",
      "kind": "text"
    }
  ]
}
```json

</details>

**Non-blocking items, all applied.** `longClickableByNodeIndex` is now required on the exact `android-helper` evidence and its only producer always writes it, so the optional chain is gone and the fixtures that built exact evidence set the new map. `commands.md` and the audit help say these nodes report under role `clickable`, a role the snapshot itself never shows. The `cliDetail` and `commands.md` collapse wording now says the container reports the control "for each finding kind the container reports itself."

@apex-sentinel-staging

This comment has been minimized.

@thymikee

Copy link
Copy Markdown
Member Author

The PR is ready at 09d2721, and the earlier findings from #4780 (comment) are now fixed. Not blocking, and you can take or leave it: the shared-name skip in https://github.com/callstack/agent-device/blob/09d2721/packages/capture-kit/src/snapshot/snapshot-audit.ts#L134 keys on role === "clickable" instead of on where the name came from, so two role-less Android touchables that carry the same own contentDescription (for example two icon-only Pressables both labeled "Delete") are never grouped and raise no ambiguous-name finding; you could skip grouping only when ownName(node) is undefined, or keep it as is since the docs state the exclusion plainly.

The open thread #4780 (comment) no longer applies: coveredRole now resolves through auditRole and a covered clickable android.view.View test asserts the role, so you can resolve it.

The live run covered only small-target on role-less TextViews through the strip-and-restore route. Covered-control, the shared-name skip, missing-name and container collapse for role-less touchables were not run on device; unit tests cover them. Coverage runs the capture-kit and contracts tests this change touches.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 19, 2026
@thymikee

Copy link
Copy Markdown
Member Author

Optional item applied at 5c749d7.

  • A role-less touchable now joins the shared-name check when it has a name of its own. Only one named by its descendants is excluded, because TalkBack joins their text.
  • New test: two icon-only android.view.View touchables both labeled "Delete" report ambiguous-name twice. It fails without the change. The two-feed-rows test still reports nothing.
  • commands.md and the audit cliDetail describe the narrower rule.
  • check:affected --run passed with exactCommit=true.
  • Thread r4634628409 is resolved; the fix landed at 09d2721.

@apex-sentinel-staging

Copy link
Copy Markdown

Apex Sentinel · ✅ Approve · review of 5c749d7

Since the review of 09d2721: 0 new · 0 still open · 0 no longer raised

No open findings.

Reviewed with this repository's own Sentinel configuration (0b9186494f80).

💬 Talking to Sentinel

In a finding's thread, reply with:

Command What it does
@apex-sentinel-staging note <context> Adds context; Sentinel re-checks the cited code
@apex-sentinel-staging pivot <why> Says the finding is wrong; Sentinel re-checks the cited code
@apex-sentinel-staging like Marks the finding as useful
@apex-sentinel-staging dislike <why> Marks it as not useful, so it is not raised again

On this conversation, comment @apex-sentinel-staging review to run a full review once again.

@thymikee

Copy link
Copy Markdown
Member Author

Still ready at 5c749d7. The change since 09d2721 lets a role-less Android touchable join the shared-name check when it has a name of its own, so two icon-only touchables both labeled "Delete" are reported again. One named only by its descendants stays excluded. The new test covers that case, and the help and command docs say the same. The label stays.

@thymikee
thymikee merged commit 7a3ab83 into main Nov 20, 2026
19 of 20 checks passed
@thymikee
thymikee deleted the feat/audit-android-roleless-clickables branch November 20, 2026 06:41
thymikee added a commit that referenced this pull request Nov 20, 2026
* origin/main:
  chore(gates): ratchet wire-published reason literals by value (R89) (#4779)
  feat(audit): evaluate role-less clickable views on Android (#4780)
  fix(mutation): keep umask-setting tests out of Stryker's thread pool (#4785)
thymikee added a commit to pcbeingused333/agent-device that referenced this pull request Nov 20, 2026
* origin/main: (70 commits)
  refactor(apple-runner): one RUNNER_ERROR_CODES row per runner error code with parity/docs gates (callstack#4774)
  fix(android): require acknowledgements for test IME typing (callstack#4722)
  feat(scroll): add scroll refresh for pull-to-refresh (callstack#4770)
  refactor(host-kit): add request Scope and use it for the wait capture deadline (callstack#4794)
  fix(android): let permission all change nothing on an app that declares no permissions (callstack#4796)
  fix(cli): replace the CLI session and generated remote config instead of rewriting them in place (callstack#4797)
  fix(host-kit): accept a group-writable script directory the user owns (callstack#4799)
  fix(cli): escape control characters at the CLI's stdout and stderr writes (callstack#4778)
  fix(audit): do not report rows under a persistent bar that scrolling reveals (callstack#4775)
  fix(daemon): refuse an unsafe state directory before first use (callstack#4783)
  refactor: settle remaining single-deadline races through settleWithin (callstack#4788)
  refactor(host-kit): settle deadline races via settleWithin with R87 race ratchet (callstack#4766)
  fix(android): authenticate and bound persistent snapshot helper sessions (callstack#4729)
  fix(daemon): bound upload ingress and finalization (callstack#4721)
  chore(gates): ratchet wire-published reason literals by value (R89) (callstack#4779)
  feat(audit): evaluate role-less clickable views on Android (callstack#4780)
  fix(mutation): keep umask-setting tests out of Stryker's thread pool (callstack#4785)
  feat(audit): report controls that share one accessible name (callstack#4771)
  fix(contracts): pair open runtime hints with their apply operation (callstack#4754)
  refactor(daemon): report startup progress over the launch channel instead of marker files (callstack#4777)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

audit (Android): evaluate role-less clickable views

1 participant