Repository navigation
[docs] ADR: accessibility tree snapshots ship as a script-based module before a BiDi command exists - #18205
[docs] ADR: accessibility tree snapshots ship as a script-based module before a BiDi command exists#18205AutomatedTester wants to merge 12 commits into
Conversation
…e before a BiDi command exists
|
/agentic_describe |
PR Summary by QodoDocument the proposed BiDi accessibility snapshot strategy
AI Description
Diagram
High-Level Assessment
Files changed (1)
|
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewTip of the day💡 Did you know, you can open the rule or relationship behind a finding in one click Previous reviewsReview updated until commit 9eeaf92 Results up to commit 7647a64
|
|
Code review by qodo was updated up to the latest commit 577e841 |
diemol
left a comment
There was a problem hiding this comment.
I do like the idea overall because this is a good feature to have and to offer our end users.
But I don't see what the public API will look like. What are the methods we're going to offer, and what is the contract?
We're talking about a schema which seems to be deferred to the implementation PR, but the ADR says that changes are breaking, so it's hard to keep that promise if we don't declare the schema already.
We should also think about how each binding will adopt this. In that way, we can avoid each binding going its own way.
This is all about BiDi, but are sessions with Webdriver Classic in scope as well? If not, we should write that explicitely.
By the way, this seems to be using the wrong PR template. It's using the template for pull requests and not the one for HDRs, so can you please correct that?
… and Classic scope Addresses review: the record now fixes method names per binding, the AccessibilityNode schema and a compatibility rule, a shared test corpus as the cross-binding contract, and states that WebDriver Classic sessions raise. Sections reordered to match the ADR template.
|
Code review by qodo was updated up to the latest commit 61997b1 |
Root node, iframe token, hidden-root behaviour, the full text-form grammar, the states table as implemented, the corpus location and schema, shadow DOM limits, and a first wire-size data point.
|
Code review by qodo was updated up to the latest commit 367e06e |
|
A few more things:
|
|
@diemol thanks, all three are fair. Taking them in order: 1. Element references from child frames. You're right, and the record overstates it. Classic element commands resolve a reference against the current browsing context, so a node from a child frame (cross-origin or not) gives "no such element" until the driver is switched into that frame. The same applies the other way: a whole-page snapshot is rooted at the top-level context, so if the driver is switched into a frame, top-level nodes fail too. I'll make the contract say this directly: a reference is usable with Classic commands while the driver's current frame is that node's document, and with BiDi commands that take a I don't want the bindings to switch frames implicitly, for the same reason the record rejects Classic: it changes the session's current browsing context as a side effect. Routing click and send keys for these elements through BiDi 2. Length. Agreed. I'll cut Context down to the problem, the state of #443 with links (dropping the minutes, WPT RFC and charter detail), and the precedent paragraph; shrink each considered option to a line or two; and tighten Consequences. The API contract, data model and compatibility rule stay as they are. With the two tables it won't get to a single page, but it should get close. 3. Text rendering in the atom. It was considered, but the record doesn't say so, and it should. The atom runs once per document and never sees the stitched tree; that happens in the binding. To render in the atom, the binding would send the stitched tree back into the page and call the renderer there. That works, but it costs an extra round trip carrying the whole tree (about 366 KB for 5,000 nodes), and it means a snapshot can't be rendered without a live session, so a saved or deserialized I'll push these changes to this PR. |
…text-rendering option, shorten
|
Code review by qodo was updated up to the latest commit 95d94c6 |
… atom injection, wire entry, text escaping Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Code review by qodo was updated up to the latest commit e89cbfa |
diemol
left a comment
There was a problem hiding this comment.
Thanks for the changes. My earlier points are covered: the API, schema, Classic scope, frame references and the text rendering choice. LGTM once the two small comments above are handled.
A node of role link carries the resolved absolute URL of its element's href as an optional url field, as CDP's accessibility tree exposes it; a link without href has none. The text form does not render it, as it does not render the description. Raised in review of the implementing PR, where the href was reachable only through the element reference.
|
Code review by qodo was updated up to the latest commit 02dd33d |
Both snapshot methods take an optional interestingOnly parameter, true by default, after Puppeteer's accessibility.snapshot(): with false the pruning rule is turned off and every rendered element produces a node, with generic, none and presentation reported as the roles they are. Hidden-ness, names, states and references are the same in both modes, and the corpus records both forms of every page. Requested in review of the implementing PR by users of CDP's full tree; always pruning and never pruning are recorded as the rejected options.
|
Code review by qodo was updated up to the latest commit 2df928c |
|
Code review by qodo was updated up to the latest commit cfa486e |
…delivery to the implementing PRs Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Code review by qodo was updated up to the latest commit c26ee1b |
titusfortner
left a comment
There was a problem hiding this comment.
- This shouldn't be limited to BiDi.
- The snapshot method should respect the current driver context, so if it is switched into a frame, the results should be limited to just the frame's context.
- I don't think the method belongs in driver/element interface, it should have its own interface (like
TakeScreenshot/JavaScriptExecutor) - I think this ADR is over-specifying a number of implementation details that don't matter for the decision we are making. So there are a lot of little things I'd quibble with in the decisions that I don't think are correct, but I also don't think they matter? For example:
- I don't think we need to include anything about the parameters or potential future toggles we may add for additional arguments; as long as we have the name and the output set we can add things later if/when we decide to.
- Section 4’s export paths, packaging forms, corpus location and per-browser test matrix are implementation details that don't matter to the decision.
- Section 5’s @wdio/snapshot comparison and spec-contribution plan are intentions with external dependencies, not decisions.
I think we may want to tweak our README/Template a bit to keep these more focused.
…le interface, drop implementation detail Addresses review from Titus: the snapshot is no longer BiDi-only, the driver's snapshot is rooted at the current browsing context, the methods live on their own interface like TakesScreenshot, and parameters, packaging, corpus layout and spec plans are left to implementing PRs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
/agentic_review |
|
Code review by qodo was updated up to the latest commit 9eeaf92 |
titusfortner
left a comment
There was a problem hiding this comment.
Thanks for the changes. Everything looks good to me now. I merged #18291 so we can do a release
| - The driver's snapshot is rooted at the driver's current browsing context: the top-level | ||
| document, or the frame the driver has switched into. Its root node has role `document`, is named | ||
| from that document's title, and references its document element. | ||
| - An element's snapshot always produces a root node, even when the pruning rule below would drop |
There was a problem hiding this comment.
if in the root visibility: hidden and child in root has visibility: visible , it still retuns the child.
and buildtree in atom only skips children when the complete subtree is hidden with aria-hidden, display: none
| ### 3. Element references | ||
|
|
||
| Every node backed by an element carries it as the binding's normal element type, so a snapshot | ||
| node can be acted on without a second lookup. Element commands resolve references against the |
There was a problem hiding this comment.
it may work differently in clasic and bidi, example in frame , bidi returns all frames and classic returns the frame we are currently in. also i see in py code comments WebDriver Classic session the element must belong to the driver's current browsing context and behavior is diff in bidi
sorry if i am wring here
|
|
||
| ### 1. Public API | ||
|
|
||
| The snapshot methods live on their own interface, as screenshots do with `TakesScreenshot`, |
There was a problem hiding this comment.
from my understanding, in Java, screenshots work directly on an element, but a driver needs a cast first because WebElement extends TakesScreenshot and WebDriver does not.
If snapshots copies this, the method ends up on WebElement, but the ADR rejects putting the method on WebElement
If snapshots do not copy this, every element needs a cast before taking a snapshot so confused here
📄 The decision, its rationale, considered options, and consequences are in the record file
this PR adds; read it there. The sections below are proposal notes and review logistics.
🔗 Related
📝 Proposal notes
🗣 Discussion
Revised after the first review (public API, schema, binding adoption, Classic scope):
stateskeys are non-breaking; accuracy fixes to names, roles and pruning can ship in any release) acceptable?dom-accessibility-api.Discussed at the TLC meetings below; see the minutes for the full discussion and attribution.
📌 Tracking
Tracking issue: (linked on acceptance)
🤖 AI assistance
🤖 Generated with Claude Code