fix: report mobile element geometry and viewport visibility - #45
Merged
Merged
Conversation
Mobile a11y observations overstated what the agent could see and act on: list_testids labeled every identifier `visible: true` without checking bounds, the accessibility snapshot discarded element frames, and tool copy described swipe coordinates with the wrong units or direction. - carry element frames in accessibility snapshot nodes (`bounds`, in logical points, mobile backends only) - derive list_testids visibility from the element frame vs device viewport intersection; unknown geometry stays `visible: true` - describe device_swipe coordinates as logical points (not pixels) and scroll_to_element direction as finger-swipe semantics - device_swipe completion never proved content movement; the swipe tool description on device-mcp now says so (paired PR)
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
pnarayanaswamy
approved these changes
Sep 15, 2026
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.
fix: report mobile element geometry and viewport visibility
Summary
Mobile accessibility observations overstated what an agent could see and
act on, which contributed to a failed visual-QA run (an executor clicked
a below-fold element, reported success, and verified nothing; agents
repeated no-op swipes because nothing told them the content had not
moved). Paired with a device-mcp gesture fix — this PR makes the mobile
observation layer honest about geometry and visibility.
Problems (all confirmed against the shipped 0.8.0 code paths)
getTestIdslabeled every identifiervisible: truewithout lookingat bounds. In the investigated run, an element far below the fold was
therefore indistinguishable from an on-screen one.
normalizeSnapshotdiscarded element frames entirely, so theaccessibility snapshot carried no geometry an agent could use to
decide what is on-screen.
device_swipe's distance wasdescribed as "pixels" (gestures take logical points; on iPhone 16 Pro
the screenshot is 1206x2622 px while the gesture space is 402x874 pt),
and
scroll_to_element'sdirectionwas described as "Scrolldirection to reveal the target element" while it is actually forwarded
as the finger-swipe direction (
upscrolls content down).Changes
A11yNodeTrimmedgains an optionalboundsfield (logical points)and the mobile accessibility snapshot populates it from element
frames. Optional, so the browser driver path is unchanged.
getTestIdsderivesvisiblefrom the element frame vs deviceviewport intersection: off-screen elements report
visible: false,partially visible elements report
true, and elements with unknowngeometry (or when the viewport is unavailable) conservatively stay
visible: true. Bounds intersection does not account for occlusion —documented on the type.
device_swipecoordinates are "logical points,not screenshot pixels";
scroll_to_element's direction describesfinger-swipe semantics ("swipe up scrolls content down").
Not changed
device_swipestill returns on command completion; it does not claimverified content movement (and the tool description now says so). A
movement postcondition belongs at the workflow layer, which already
compares before/after screenshots.
Testing
visible: false, partially visible →true, viewport unavailable → conservativetrue; snapshot nodescarry
bounds. Full suite (1551 tests) and lint pass.device-mcp, which also fixes the no-op swipe gesture itself).
Related
getWindowSizereturns points everywhere).