Skip to content

Navigation Menu

Sign in
Sign up

Fix walkAXTree ignoring children of ignored nodes - #26

Open
danieljohnbyns wants to merge 1 commit into
different-ai:main from
danieljohnbyns:main
Open

Fix walkAXTree ignoring children of ignored nodes #26
danieljohnbyns wants to merge 1 commit into
different-ai:main from
danieljohnbyns:main

Conversation

@danieljohnbyns

@danieljohnbyns danieljohnbyns commented Jul 21, 2026

Copy link
Copy Markdown

Problem

browser_snapshot only returned the root element on real websites (e.g. Google, Example Domain). The accessibility tree was being truncated because walkAXTree returned null immediately for any ignored node without a name, cutting off its entire subtree.

Root Cause

Chrome's accessibility tree wraps content in <div> containers with role none and ignored=true. When walkAXTree encountered these nodes, the early return null at line 35 prevented traversal into their children, which contained the actual page content.

Fix

Instead of returning null, the function now:

  • Recursively processes children of ignored+noname nodes
  • Returns null if no children remain (0 children)
  • Promotes the child up (1 child)
  • Wraps multiple children in a transparent generic container

Testing

Verified with a standalone CDP script and in OpenCode against:

  • example.com — heading, paragraph, link all appear
  • google.com — full page tree with search box, buttons, results
  • browser_fill and browser_click now work with the returned UIDs

When an accessibility node is marked as ignored with no name, the code
was returning null immediately, which cut off the entire subtree below
it. This caused browser_snapshot to return only the root element on
real websites like Google.
Now it still recurses into children and flattens them:
- 0 children -> null
- 1 child -> promoted up
- multiple children -> wrapped in transparent generic node
Copilot AI review requested due to automatic review settings July 21, 2026 20:03

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copy link
Copy Markdown
Author

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

wow, way to call me out for vibe coding too much 😭

Copilot AI 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.

Pull request overview

Copilot reviewed 1 out of 2 changed files in this pull request and generated no new comments.

Suppressed comments (1)

src/lib/snapshot.ts:48

  • The promoted wrapper node is constructed without required SnapshotNode fields (name, backendNodeId). This will fail TypeScript type-checking and can also break browser_click/browser_fill when a user selects this UID (backendNodeId becomes undefined). Populate these fields (e.g., empty name and the current node’s backendNodeId).
 const uid = nextUid++;
 const node: SnapshotNode = { uid, role: "generic", children };
 byUid.set(uid, node);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot
Copilot review effort, defaults to Lite
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

AltStyle によって変換されたページ (->オリジナル) /