fix(snapshot): resolve DevTools selected element in take_snapshot output - #2293
Closed
syf2211 wants to merge 2 commits into
Closed
fix(snapshot): resolve DevTools selected element in take_snapshot output#2293syf2211 wants to merge 2 commits into
syf2211 wants to merge 2 commits into
Conversation
When an element is selected in the DevTools Elements panel, take_snapshot now resolves selectedElementUid against the snapshot being built instead of the previous textSnapshot. If the selected node is missing from the a11y tree, insert it via adoptBackendNode so agents can read its uid and properties. Fixes ChromeDevTools#2243
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Author
|
I have read the CLA Document and I hereby sign the CLA |
Author
|
recheck |
Author
|
recheck |
1 similar comment
Author
|
recheck |
Author
|
I have read the CLA Document and I hereby sign the CLA |
Author
|
recheck |
Contributor
|
Hi, thank you for you effort, but that issue has already been solved in #2295 . Closing as duplicate |
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.
Summary
Fix
take_snapshotso the element selected in the Chrome DevTools Elements panel is exposed with a stableuidand[selected in the DevTools Elements panel]marker.Motivation
Fixes #2243. When users select an element in DevTools and ask an agent to inspect it, the snapshot reported that an element was selected but did not identify which one. This happened because:
selectedElementUidwas resolved against the previoustextSnapshot, not the snapshot being built.Changes
selectedElementUidfrom the in-progress snapshot tree (idToNode).adoptBackendNodeand insert it with the existinginsertExtraNodespath.page.extraHandlesafter the temporary selected-element insertion to avoid leaking state across snapshots.Tests
node scripts/test.mjs tests/TextSnapshot.test.ts tests/formatters/snapshotFormatter.test.ts— all passnpm run check-format— passNotes