Skip to content

fix(web): read content hidden under a closed details across shadow roots - #2007

Merged
okwasniewski merged 4 commits into
mainfrom
michal/eng-1397-closed-details-shadow
Nov 21, 2026
Merged

okwasniewski merged 4 commits into
mainfrom
michal/eng-1397-closed-details-shadow

Conversation

@michal-e2e

@michal-e2e michal-e2e commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

toBeVisible() passed on content a closed <details> hides when that content sits across a shadow boundary. For example, a test that opens an accordion whose panel is a web component and checks the panel stayed green even when the panel never opened.

  • isInClosedDetails walked up with closest('details'), which stops at a shadow boundary. It now walks the flat tree with the file's own flatParentOf, so a shadow tree under a closed <details> and an element slotted into one fold with it. This is the change from @okwasniewski's f57eeb7 in feat(web)!: WebDriver BiDi driver replaces Playwright #1503, landed on its own while feat(web)!: WebDriver BiDi driver replaces Playwright #1503 is in review; the commit credits him.
  • It knows a <details> by its local name and the HTML namespace rather than instanceof HTMLDetailsElement, so a <details> adopted from another frame still folds, as it does with closest on main. An element named details in another namespace no longer folds its children, which the browser paints; closest('details') matched it on main.
  • isSkippedContent stepped up with assignedSlot, which is null for a slot in a closed root, so content slotted into a closed root under content-visibility: hidden read as visible. It now steps with flatParentOf too, as in feat(web)!: WebDriver BiDi driver replaces Playwright #1503.
  • The visibility walk now asks slotOf for every light child of a closed root's host. In a root that assigns by name, slotOf finds the element's slot from its slot attribute: the first HTML slot of that name, the browser's rule, both attributes read outside any namespace. It never lists what a slot holds, so a locator's read of one match costs one pass over the root's slots. A root that assigns by hand is read from each slot's assignedElements(). Both are built once per root in a read.
  • The fold keeps the first child that is an HTML <summary>, so an element named summary in another namespace no longer stands in for it. That lookup is memoized per <details> for the read, so a wide <details> is walked once.
  • A <details> folds its body when its ::details-content skips its contents (skipsContents), the browser's own rule for a closed <details>, so a page whose CSS shows a closed body, through content-visibility or by laying it out as display: contents, reads visible. Without that pseudo element, the open attribute decides. The fold is asked before the summary is looked up, so an open <details> never looks.
  • content-visibility: hidden skips nothing on these display values: contents, inline, inline list-item, table, inline-table, a table row or row group, ruby, ruby-text. Each was checked against checkVisibility() in Chromium; a table cell and an inline block do skip theirs. An HTML <button> or <fieldset> makes a box of its own and skips whatever its display, short of display: contents. In SVG only an outermost <svg> (parent not SVG, or a <foreignObject>) has a box for the property to act on, and it always skips; other SVG elements ignore it. One predicate, skipsContents, now answers this for isSkippedContent, the tree walk and directTextOf, which each read the raw property before, so a control the reader calls visible is also in the agent's tree. Main read all three as skipping, in light DOM and open roots too.
  • The agent's tree no longer lists the slotted controls either; it already left out a shadow tree under a closed <details>.
  • Not checkVisibility(): it calls a display: contents wrapper with a painted child hidden, which the reader treats as visible on purpose (fix(web): visibility reads the box, the style, and closed details, SVG included #560).
  • New tests are in visibility-shadow.test.ts, not visibility.test.ts, which feat(web)!: WebDriver BiDi driver replaces Playwright #1503 rewrites. A new crosscheck fixture page puts the slotted and closed-root cases in front of Chrome's accessibility tree and Playwright's getByRole.

The flat-tree walk from a button slotted into a <details> inside a shadow root:

flowchart LR
  B[button] --> S[slot] --> D["details (closed)"] --> H[host]
Loading

closest('details') went from the button straight to its light-DOM parent and never met the <details>.

For maintainers

  • A display: contents control whose own text is its content, under a closed <details>, still reads visible, in light DOM and across shadow roots: isHidden returns from its display: contents branch before it asks about the fold. That is main's behavior and what Playwright's isHidden() says; Chrome's checkVisibility() calls it hidden. feat(web)!: WebDriver BiDi driver replaces Playwright #1503 asks the fold first, which changes it for light DOM too, so I left it to feat(web)!: WebDriver BiDi driver replaces Playwright #1503.

  • An element slotted into a closed root declared with <template shadowrootmode="closed">, under a closed <details> or content-visibility: hidden, still reads visible: the engine cannot reach such a root, so the walk never sees its slots.

  • A shadow tree inside a <details> adopted from another frame still escapes the fold, on main too: parentOrHostOf tests instanceof ShadowRoot, which fails for a root from another frame. It is a shared helper; I left it alone.

  • isReadInLine (read-semantics.ts:969) still steps with el.assignedSlot ?? parentOrHostOf(el). feat(web)!: WebDriver BiDi driver replaces Playwright #1503 changes it to flatParentOf too, but it groups line text and does not decide visibility, and I have no failing case for it.

  • content-visibility: hidden on a table cell reads as skipping its contents, as Chromium renders it. Firefox and WebKit paint those contents, and Playwright calls them visible there; main reads them hidden on every browser too.

  • A locator reads each match in its own reader call, so each match lists the closed root's slots once: N matches in N named slots compare N² names, and a root that assigns by hand still calls assignedElements() per slot per match. Sharing that across one locator query needs a cache in three selector engines; I left it out (timings under Verified).

  • Browsers disagree on a few of these, and the reader follows Chromium: WebKit paints an inline <fieldset>'s contents and skips a nested <svg>'s; Firefox paints a <button> or <fieldset> laid out as a table or table row; WebKit does not parse inline list-item, and the reader then agrees with WebKit's isHidden().

  • table-caption stays out of the list: Chromium's checkVisibility() and Playwright call a skipped caption's button visible, but a screenshot shows 0 of its 3,600 red pixels, and Firefox and WebKit call it hidden. The reader reads it hidden.

  • A control is still named from content content-visibility: hidden skips (<button style="content-visibility:hidden"><span>Save</span></button> is button "Save"; Chrome's tree has no name). Main does the same, for any role; it is name computation, not visibility, so it is not in this PR.

Issue

Linear ENG-1397 and ENG-1398.

Verified

Ran it locally: yes

  • Real Chromium through the built launch(web()) and expect, the user's entry point: 02-closed-details-shadow.mjs and 03-shadow-visibility.mjs load a page with each case, then call isVisible(), expect(...).toBeVisible() and expect(...).toBeHidden() on it, twice on each build. main is 9e4e6d3df, whose read-semantics.ts is byte for byte the one at b25bb45a7, this branch's base.
Element main this branch
button in light DOM under closed <details> (control) toBeVisible() fails toBeVisible() fails
button in a shadow root under closed <details> toBeVisible() passes toBeVisible() fails, toBeHidden() passes
button slotted into closed <details> in a shadow root toBeVisible() passes toBeVisible() fails, toBeHidden() passes
button slotted into a closed root under content-visibility: hidden toBeVisible() passes toBeVisible() fails, toBeHidden() passes
same, open root (control) toBeVisible() fails toBeVisible() fails
button in a closed <details> whose CSS shows the body through ::details-content, in a shadow tree toBeVisible() passes toBeVisible() passes
button slotted under content-visibility: hidden on a display: contents or inline wrapper toBeVisible() passes in a closed root, fails in an open root toBeVisible() passes
  • The last two rows come from a third page, run twice on each build: Playwright's isVisible(), the element's own checkVisibility(), and a hit test at its center all call those buttons visible.
  • pnpm --filter @e2e-dev/web exec vitest run tests/integration/visibility-shadow.test.ts with each reader swapped in: main's (1b007d4d7) fails 27 of 60, this PR before the review round (5e2c130a4) fails 17, this branch passes 60. With firefox imported in place of chromium it passes 60; with webkit, 56, the four failures being the WebKit differences above.
  • Crosscheck on main: 8 new disagreements on the first new fixture page, for the three slotted buttons and the closed-root content-visibility one (Chrome has no AX node and Playwright no match; ours listed them). A second page holds the review round's cases; the reader at 5e2c130a4 has 7 disagreements there (five buttons Chrome lists that ours dropped, the inline fieldset's button the other way). On this branch: 0 on both. Every web-benchmark scenario passes with expected.txt unchanged, and conformance passes with its expected.txt unchanged.
  • Hand-written mutants in the reader, each killed by a named assertion: stepping isSkippedContent with assignedSlot, ignoring open, folding by the open attribute alone, skipping on any display, on inline, contents or a table row, not skipping in a table cell, the tree walk or directTextOf reading the raw property, dropping the <summary> exception, accepting any <summary>, one that is not a child, the first in the subtree or one outside HTML, walking isInClosedDetails in the light tree, instanceof for the <details> check, an unmemoized summary lookup, no slot map, counting SVG slot elements, and reading the slots again for every child.
  • A tree read of a closed <details> with 2,000 children copies 2,001 child references on both builds.

Review round (kdy1's five threads), through launch(web()) and screen (verify-round2.mjs), next to the element's own checkVisibility():

Element main 1b007d4d7 before the round 5e2c130a4 this branch
link in an inline <svg style="content-visibility:hidden"> (browser: hidden) hidden visible hidden
button slotted into a closed root's <table style="content-visibility:hidden"> (browser: visible) visible hidden visible
button in an inline <fieldset> with it (browser: hidden) hidden visible hidden
shadow button in a closed <details> laid out as display: contents (browser: visible) visible hidden visible
light button there; button in a table, inline-table, ruby, inline list-item with it (browser: visible) hidden hidden visible

screen.getByText(..., { visible: true }).count(), median of warm runs, two rounds, Chromium:

Rows slotted into one closed root main before the round this branch
1,000 in one default slot ~100 ms ~135 ms ~100 ms
300 in a named slot each ~35 ms ~56 ms ~49 ms

Main is cheapest there because it never looks inside a closed root, which is the bug. Through the visible: true selector engine, one call per candidate, elements read from slots: 100 in a named slot each, 10,000 before the round and 0 now; 1,000 in one default slot, 1,000,000 and 0.

  • Mutation trial on the review round's code, 25 hand-written mutants, each failing a named test: slotOf as before the round, the last slot of a name winning, SVG slot elements counting, a hand-assigning root read by name and every root read by hand, slots listed per element, the default slot missed, the slot or name attribute read in any namespace; the tree walk or directTextOf ignoring the own-box rule; no <fieldset>, no <button> (fails the ruby row; the inline row fails it in Firefox), display: contents ignored; no outermost <svg>, SVG falling to the display rule, a nested <svg> counted as outermost, a <foreignObject> parent not; foldsBody reading only content-visibility; the summary looked up first; inline-block added to the list; each of table, inline-table, ruby, inline list-item dropped.

🤖 Generated with Claude Code

isInClosedDetails walked up with closest('details'), which stops at a
shadow boundary, so a shadow tree under a closed <details>, or an element
slotted into one, read as visible and passed toBeVisible(). It now walks
the flat tree with flatParentOf, the change from #1503's f57eeb7. It
knows a <details> and its first <summary> by name and the HTML namespace,
so a <details> adopted from another frame still folds.

isSkippedContent stepped up with assignedSlot, which is null for a slot in
a closed root, so content slotted into a closed root under
content-visibility: hidden read as visible. It now steps with flatParentOf
too.

slotOf, which the visibility walk now asks for every light child of a
closed root's host, scanned every slot's assigned elements per element.
It now reads a closed root's HTML slots once per read into a map, by exact
slot name or, for a root that assigns by hand, by element.

Co-authored-by: Oskar Kwaśniewski <oskar@okwasniewski.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@michal-e2e michal-e2e added the e2e team Opened by the e2e team label Nov 20, 2026
@github-actions github-actions Bot added the size:M Up to 99 changed lines, not counting tests, fixtures, translated docs, or the lockfile label Nov 20, 2026
@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

🟢 e2e web: 95 passed

All 95 tests in 43 files
Test Time
🟢 tests/aria-hidden-flow.e2e.ts · 2 passed 560ms
🟢 aria hidden flow › picks the Pro plan by its visible text and confirms it 422ms
🟢 aria hidden flow › another plan shows the error and keeps the picker open 138ms
🟢 tests/async-states.e2e.ts · 2 passed 6.9s
🟢 async states › reads the code off the transient toast and verifies it once the button enables 2.2s
🟢 async states › a wrong code is rejected after the toast has gone 4.7s
🟢 tests/canvas-only.e2e.ts · 2 passed 217ms
🟢 canvas only › taps square, circle, then diamond at their pixel coordinates 118ms
🟢 canvas only › a shape out of order paints the error and resets progress 99ms
🟢 tests/canvas-whiteboard.e2e.ts · 2 passed 318ms
🟢 canvas whiteboard › drags both shapes into their slots and saves 184ms
🟢 canvas whiteboard › bounces a shape off the wrong slot and refuses to save early 134ms
🟢 tests/cart-totals.e2e.ts · 2 passed 308ms
🟢 cart totals › increasing a quantity updates the line total but the order summary stays stale (planted bug) 176ms
🟢 cart totals › a quantity never drops below one 132ms
🟢 tests/checkout-review.e2e.ts · 1 passed 131ms
🟢 shows a raw greeting token and an undefined delivery date (planted bug), yet places the order 131ms
🟢 tests/context-menu-trap.e2e.ts · 2 passed 478ms
🟢 context menu trap › right-click opens nothing; the row menu renames the file 251ms
🟢 context menu trap › the decoy menu items refuse and keep the file 227ms
🟢 tests/control-inventory.e2e.ts · 8 passed 3.1s
🟢 control inventory › check sets the checkbox and the radio without flipping a set one 215ms
🟢 control inventory › check picks a radio the pick replaces with its summary 139ms
🟢 control inventory › a long press and a double click are told apart from a tap 961ms
🟢 control inventory › the file menu opens on right-click only and Rename renames the file 201ms
🟢 control inventory › setInputFiles attaches files named from the project root 115ms
🟢 control inventory › the details view is left through the browser history 149ms
🟢 control inventory › scrollIntoView brings the footnote into view 153ms
🟢 control inventory › every exercise done shows the success message 1.2s
🟢 tests/css-content-ui.e2e.ts · 2 passed 280ms
🟢 css content ui › the tile labelled Ship it advances and confirming ships 161ms
🟢 css content ui › a wrong tile shows the CSS-rendered error and keeps the picker 119ms
🟢 tests/date-picker.e2e.ts · 2 passed 528ms
🟢 date picker › navigates three months ahead and books the required date 311ms
🟢 date picker › confirming without the exact date shows the error 217ms
🟢 tests/debounced-search.e2e.ts · 2 passed 2.7s
🟢 debounced search › a decoy one character off is refused 1.4s
🟢 debounced search › picking the exact item adds it to the cart 1.3s
🟢 tests/deferred-dialog.e2e.ts · 1 passed 1.0s
🟢 one submit opens one confirm, even when double-clicked 1.0s
🟢 tests/div-soup.e2e.ts · 2 passed 561ms
🟢 div soup › a wrong code is rejected 247ms
🟢 div soup › the right code grants access after the delete tile fixes a typo 314ms
🟢 tests/drag-and-drop.e2e.ts · 2 passed 564ms
🟢 drag and drop › an out-of-order item resets the dropzone 282ms
🟢 drag and drop › dropping Banana then Cherry passes 282ms
🟢 tests/file-round-trip.e2e.ts · 2 passed 275ms
🟢 file round trip › downloads the issued voucher and verifies the same file uploaded back 134ms
🟢 file round trip › rejects a file that is not the voucher, then accepts the issued one 141ms
🟢 tests/filter-deep-link.e2e.ts · 2 passed 192ms
🟢 filter deep link › filtering writes the query to the URL 108ms
🟢 filter deep link › opening a shared link restores the filter 84ms
🟢 tests/gift-card-purchase.e2e.ts · 3 passed 476ms
🟢 gift card purchase › refuses to buy without an amount 131ms
🟢 gift card purchase › refuses a recipient without an at sign 165ms
🟢 gift card purchase › sends the gift card 180ms
🟢 tests/hover-menu.e2e.ts · 2 passed 400ms
🟢 hover menu › a decoy leaf is refused 184ms
🟢 hover menu › hovering Account, then Billing, reaches Redeem voucher 216ms
🟢 tests/iframe-form.e2e.ts · 2 passed 447ms
🟢 iframe form › a wrong code is refused by the host page 194ms
🟢 iframe form › the code read from one frame applies through the other 253ms
🟢 tests/image-only-ui.e2e.ts · 3 passed 366ms
🟢 image only ui › the icons have no names, so the bare svg locator is ambiguous 87ms
🟢 image only ui › a wrong icon shows the error image and keeps the icons 130ms
🟢 image only ui › tapping the star, then the heart, verifies the icons 149ms
🟢 tests/infinite-scroll.e2e.ts · 1 passed 2.7s
🟢 scrolls the feed until the Golden Ticket loads, then claims it 2.7s
🟢 tests/kanban-board.e2e.ts · 3 passed 586ms
🟢 kanban board › pointer drags move both cards into the goal layout 319ms
🟢 kanban board › a swipe along a path drags a card as well 119ms
🟢 kanban board › a plain tap moves nothing and the untouched board is rejected 148ms
🟢 tests/login-form.e2e.ts · 4 passed 632ms
🟢 login form › rejects a malformed email 149ms
🟢 login form › rejects a short password 150ms
🟢 login form › rejects an unknown account 150ms
🟢 login form › signs in and logs out 183ms
🟢 tests/lying-labels.e2e.ts · 4 passed 547ms
🟢 lying labels › the button whose accessible name says Pay now is the wrong one 116ms
🟢 lying labels › a text match for Pay now catches the decoy phrase too 88ms
🟢 lying labels › the field whose accessible name says Amount is the wrong one 177ms
🟢 lying labels › visible text drives the payment through 166ms
🟢 tests/native-dialogs.e2e.ts · 3 passed 353ms
🟢 native dialogs › answers the confirm, prompt, and alert chain 119ms
🟢 native dialogs › dismissing the confirm cancels the order 116ms
🟢 native dialogs › a wrong gift code is rejected 118ms
🟢 tests/new-tab-flow.e2e.ts · 2 passed 380ms
🟢 new tab flow › reads the code in the tab the app opens and enters it back in the original tab 194ms
🟢 new tab flow › a tap that opens a tab leaves the screen on the original tab, and activate shows the new one 186ms
🟢 tests/newsletter-signup.e2e.ts · 1 passed 2.2s
🟢 subscribe renders no feedback and logs a TypeError (planted bug) 2.2s
🟢 tests/onboarding-wizard.e2e.ts · 5 passed 4.1s
🟢 onboarding wizard › back keeps what was typed and the brief comes back with it 226ms
🟢 onboarding wizard › the address step takes the brief through its bare-div dropdown 281ms
🟢 onboarding wizard › the profile step steers the calendar three decades back 1.1s
🟢 onboarding wizard › the preferences step flips the toggles the brief names and leaves the trap off 1.2s
🟢 onboarding wizard › the review step repeats the brief and finishes with the PIN 1.3s
🟢 tests/order-history.e2e.ts · 2 passed 1.3s
🟢 order history › overview and settings render their panels 148ms
🟢 order history › the orders tab never leaves its loading state (planted bug) 1.2s
🟢 tests/otp-auto-advance.e2e.ts · 3 passed 1.3s
🟢 otp auto-advance › focus advances with each digit and the full code verifies 441ms
🟢 otp auto-advance › backspace on an empty box clears and refocuses the previous one 132ms
🟢 otp auto-advance › a wrong code clears every box and starts over 734ms
🟢 tests/overlay-trap.e2e.ts · 1 passed 672ms
🟢 continues only after the banner and the overlay are gone 672ms
🟢 tests/playbook-cleanup.e2e.ts · 2 passed 413ms
🟢 playbook cleanup › deleting the draft removes it from an exact-name search 211ms
🟢 playbook cleanup › cancelling the dialog keeps the draft searchable 202ms
🟢 tests/price-sorting.e2e.ts · 3 passed 323ms
🟢 price sorting › opens in the featured order with sale prices struck through 97ms
🟢 price sorting › low to high sorts by the original price, not the paid one (planted bug) 107ms
🟢 price sorting › high to low is the same wrong order reversed (planted bug) 119ms
🟢 tests/product-reviews.e2e.ts · 1 passed 1.1s
🟢 the running-shoe page lists coffee-grinder reviews (planted bug) 1.1s
🟢 tests/promo-storefront.e2e.ts · 1 passed 1.3s
🟢 buys a deal once the promo chrome is out of the way 1.3s
🟢 tests/rich-text-editor.e2e.ts · 2 passed 412ms
🟢 rich text editor › bolding exactly the required word passes the check 212ms
🟢 rich text editor › bold that spills into the previous word fails the check 200ms
🟢 tests/saved-addresses.e2e.ts · 3 passed 448ms
🟢 saved addresses › adds an address and clears the form 153ms
🟢 saved addresses › ignores an add with an empty field 148ms
🟢 saved addresses › delete shows its toast but keeps the address, on retry too (planted bug) 147ms
🟢 tests/shadow-dom-form.e2e.ts · 2 passed 335ms
🟢 shadow DOM form › rejects a wrong access code 169ms
🟢 shadow DOM form › grants access with the code from the hint inside the root 166ms
🟢 tests/smoke.e2e.ts · 1 passed 214ms
🟢 home lists the scenarios and opens one 214ms
🟢 tests/stale-dom.e2e.ts · 1 passed 2.1s
🟢 taps the moving target three times across rebuilds of the list 2.1s
🟢 tests/sticky-chrome.e2e.ts · 1 passed 151ms
🟢 accepts the terms once the button clears the sticky footer 151ms
🟢 tests/virtualized-table.e2e.ts · 1 passed 14.5s
🟢 scrolls the windowed table to the Golden Row and claims it 14.5s
🟢 tests/wishlist.e2e.ts · 2 passed 1.4s
🟢 wishlist › saving toggles the button and the tab badge 193ms
🟢 wishlist › the wishlist tab renders the empty state despite the badge count (planted bug) 1.2s

Tested by e2e 0.24.0 · 57.7s · web · run artifacts

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

🟢 e2e web agent: 34 passed

36 agent steps · 26 replayed from cache · 25 model calls · 128.5k tokens (94% cached) · $0.0054

All 34 tests in 5 files
Test Agent Time
🟢 tests-agent/control-inventory.e2e.ts · 7 passed 7 steps 7.0s
🟢 control inventory › check sets the checkbox and the radio 1 step 579ms
🟢 control inventory › check picks a radio the pick replaces with its summary 1 step 228ms
🟢 control inventory › a long press and a double click are chosen over a plain tap 1 step 851ms
🟢 control inventory › a right-click opens the file menu and Rename renames the file 1 step 2.4s
🟢 control inventory › upload attaches the named project files 1 step 2.3s
🟢 control inventory › back returns from the details view to the inventory 1 step 220ms
🟢 control inventory › scroll_to brings the footnote into view 1 step 328ms
🟢 tests-agent/login-form.e2e.ts · 1 passed 1 step 307ms
🟢 act signs in with the benchmark account 1 step 307ms
🟢 tests-agent/planted-bugs.e2e.ts · 3 passed 5 steps · 9 calls 12.7s
🟢 cart totals: a judgment catches the stale order summary 2 steps · 4 calls 4.8s
🟢 checkout review: a judgment catches the broken copy 1 step · 1 call 1.3s
🟢 wishlist: a judgment catches the lost saved items 2 steps · 4 calls 6.6s
🟢 tests-agent/scenarios.e2e.ts · 22 passed 22 steps · 16 calls 1m 11s
🟢 act completes shadow-dom-form 1 step · 3 calls 3.8s
🟢 act completes lying-labels 1 step · 3 calls 5.0s
🟢 act completes iframe-form 1 step · 3 calls 4.0s
🟢 act completes infinite-scroll 1 step 3.2s
🟢 act completes virtualized-table 1 step 15.3s
🟢 act completes overlay-trap 1 step 812ms
🟢 act completes sticky-chrome 1 step 870ms
🟢 act completes async-states 1 step · 3 calls 6.5s
🟢 act completes debounced-search 1 step 2.2s
🟢 act completes hover-menu 1 step 446ms
🟢 act completes drag-and-drop 1 step 434ms
🟢 act completes kanban-board 1 step 568ms
🟢 act completes context-menu-trap 1 step 2.6s
🟢 act completes stale-dom 1 step 399ms
🟢 act completes otp-auto-advance 1 step 644ms
🟢 act completes date-picker 1 step 705ms
🟢 act completes rich-text-editor 1 step 9.9s
🟢 act completes playbook-cleanup 1 step 489ms
🟢 act completes promo-storefront 1 step 2.2s
🟢 act completes new-tab-flow 1 step · 4 calls 8.2s
🟢 act completes gift-card-purchase 1 step 2.4s
🟢 act filters the list and the URL carries the filter 1 step 187ms
🟢 tests-agent/unique-cache.e2e.ts · 1 passed 1 step 246ms
🟢 act adds an address with a run-unique label 1 step 246ms

Tested by e2e 0.24.0 · 1m 31s · web · run artifacts

@michal-e2e michal-e2e added the Ready for Human Review Green, conflict-free, every thread handled. Waiting on a maintainer. label Nov 20, 2026
A closed <details> folds its body when its ::details-content computes
content-visibility: hidden, so a page whose CSS shows a closed body reads
visible; without that pseudo element the open attribute decides. Its
first HTML <summary> child is looked up once per read, so a wide
<details> is walked once instead of once per child.

content-visibility: hidden skips nothing on display: contents, an inline
element, a table row or row group, or ruby text, which checkVisibility()
reads as visible in Chromium. One predicate, skipsContents, answers that
for isSkippedContent, the tree walk and directTextOf, so a control that
reads visible is also in the agent's tree.

The e2e-shown, e2e-read and e2e-label selector engines read each
candidate in its own reader call. They now pass the reader one closed-slot
map for a synchronous selector operation and drop it in a microtask, so a
locator reads a closed root's slots once per operation, not per match.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added size:L Up to 499 changed lines, not counting tests, fixtures, translated docs, or the lockfile and removed Ready for Human Review Green, conflict-free, every thread handled. Waiting on a maintainer. size:M Up to 99 changed lines, not counting tests, fixtures, translated docs, or the lockfile labels Nov 20, 2026
@michal-e2e michal-e2e added the Ready for Human Review Green, conflict-free, every thread handled. Waiting on a maintainer. label Nov 20, 2026
…inly

The e2e-shown, e2e-read and e2e-label selector engines are back to main:
they no longer share a closed-slot map across the reads of one selector
operation, which only paid off on contrived pages. Within one read,
slotOf now maps each element a closed root's HTML slots hold to its slot
from assignedElements, the browser's own assignment, instead of
reimplementing named assignment. Comments are shorter.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot removed the Ready for Human Review Green, conflict-free, every thread handled. Waiting on a maintainer. label Nov 20, 2026
@michal-e2e michal-e2e added the Ready for Human Review Green, conflict-free, every thread handled. Waiting on a maintainer. label Nov 20, 2026
kdy1
kdy1 previously requested changes Nov 21, 2026

@kdy1 kdy1 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Note

This text was drafted with AI and posted after human approval.

  • Harness: T3 Code
  • AI agents: Claude Opus 5.5 (claude-opus-5-5) as coordinator and reviewer, GPT-6.2 Astra (gpt-6.2-astra) as reviewer via Codex, GPT-6.2 Sol (gpt-6.2-sol) as reviewer via Codex, Claude Sonnet 5.5 (claude-sonnet-5-5) as reviewer

The flat-tree walk fixes the cases this PR is for. I ran the reader on main (1b007d4d) and on this head (5e2c130a) with the same pages, next to Playwright's isHidden() and checkVisibility(). A shadow button under a closed <details>, a button slotted into a closed <details> (open root or closed root), and a button slotted under content-visibility: hidden in a closed root all go from visible to hidden, as Playwright reads them.

I'm requesting changes for three cases that main read correctly and this head reads wrong in Chromium, plus one locator cost regression. The details are in 5 inline comments:

  • P2, new in this PR: a ::details-content { display: contents } body reads hidden (foldsBody).
  • P2, new in this PR: content of an inline <svg style="content-visibility:hidden"> reads visible (skipsContents).
  • P2, new in this PR: a button slotted into a closed root under <table style="content-visibility:hidden"> reads hidden (BOXES_THAT_SKIP_NOTHING).
  • P2, performance: per-match locator reads now rescan a closed root's slots, so N matches cost N² assignedElements() calls (closedSlots).
  • P3: the foldsBody and firstSummaryOf order, <fieldset>, and the remaining missing display values.

The P3 items are not blockers on their own. This needs another iteration anyway, so I'm asking for them in the same round.

A trial patch for everything except the locator cost and <fieldset>: on top of this head, visibility-shadow, visibility, crosscheck, conformance, and observation pass (111 passed, 1 skipped), and @e2e-dev/web typecheck passes. With it, the probe cases match Playwright, except <fieldset>.

Trial patch
diff --git a/packages/web/src/in-page/read-semantics.ts b/packages/web/src/in-page/read-semantics.ts
index d001862a..a7aeafe7 100644
--- a/packages/web/src/in-page/read-semantics.ts
+++ b/packages/web/src/in-page/read-semantics.ts
@@ -412,11 +412,15 @@ export const readSemanticsFunction = <Mode extends SemanticMode>(
     el.ownerDocument.defaultView?.getComputedStyle(el);
 
   /** `display` values on which `content-visibility: hidden` skips nothing (checked against `checkVisibility()` in Chromium). */
-  const BOXES_THAT_SKIP_NOTHING = new Set(['contents', 'inline', 'table-row', 'table-row-group', 'table-header-group', 'table-footer-group', 'ruby-text']);
+  const BOXES_THAT_SKIP_NOTHING = new Set(['contents', 'inline', 'table-row', 'table-row-group', 'table-header-group', 'table-footer-group', 'ruby-text', 'table', 'inline-table', 'ruby', 'inline list-item']);
+
+  /** An outermost `<svg>`: a replaced element, so an `inline` one is still an atomic box that skips its contents. */
+  const isOuterSvg = (el: Element): boolean =>
+    el.localName === 'svg' && el.namespaceURI === 'http://www.w3.org/2000/svg' && el.parentElement?.namespaceURI !== 'http://www.w3.org/2000/svg';
 
   /** Whether an element with this style renders nothing under it. */
-  const skipsContents = (style: CSSStyleDeclaration | undefined): boolean =>
-    style?.getPropertyValue('content-visibility') === 'hidden' && !BOXES_THAT_SKIP_NOTHING.has(style.display);
+  const skipsContents = (el: Element, style: CSSStyleDeclaration | undefined): boolean =>
+    style?.getPropertyValue('content-visibility') === 'hidden' && (!BOXES_THAT_SKIP_NOTHING.has(style.display) || isOuterSvg(el));
 
   /** A walk from the top, with the elements that may not contribute again already visited. */
   const nameWalk = (visited: readonly Element[], accessible: boolean, fromContent = false): NameWalk => ({
@@ -859,7 +863,7 @@ export const readSemanticsFunction = <Mode extends SemanticMode>(
    * its `innerText` reads empty, so it owns none.
    */
   const directTextOf = memoized((el: Element): string => {
-    if (skipsContents(styleOf(el))) return '';
+    if (skipsContents(el, styleOf(el))) return '';
     let out = '';
     for (const child of Array.from(el.childNodes)) {
       if (child.nodeType === 3) out += child.nodeValue ?? '';
@@ -1124,8 +1128,9 @@ export const readSemanticsFunction = <Mode extends SemanticMode>(
    * Without that pseudo element, the `open` attribute decides.
    */
   const foldsBody = memoized((details: Element): boolean => {
-    const skip = details.ownerDocument.defaultView?.getComputedStyle(details, '::details-content').getPropertyValue('content-visibility') ?? '';
-    return skip === '' ? !details.hasAttribute('open') : skip === 'hidden';
+    const style = details.ownerDocument.defaultView?.getComputedStyle(details, '::details-content');
+    const skip = style?.getPropertyValue('content-visibility') ?? '';
+    return skip === '' ? !details.hasAttribute('open') : skipsContents(details, style);
   });
 
   /**
@@ -1137,7 +1142,7 @@ export const readSemanticsFunction = <Mode extends SemanticMode>(
   const isInClosedDetails = memoized((el: Element): boolean => {
     const parent = flatParentOf(el);
     if (parent === null) return false;
-    if (parent.localName === 'details' && isHtml(parent) && firstSummaryOf(parent) !== el && foldsBody(parent)) return true;
+    if (parent.localName === 'details' && isHtml(parent) && foldsBody(parent) && firstSummaryOf(parent) !== el) return true;
     return isInClosedDetails(parent);
   });
 
@@ -1149,7 +1154,7 @@ export const readSemanticsFunction = <Mode extends SemanticMode>(
   const isSkippedContent = memoized((el: Element): boolean => {
     const parent = flatParentOf(el);
     if (parent === null) return false;
-    return skipsContents(styleOf(parent)) || isSkippedContent(parent);
+    return skipsContents(parent, styleOf(parent)) || isSkippedContent(parent);
   });
 
   /**
@@ -1848,7 +1853,7 @@ export const readSemanticsFunction = <Mode extends SemanticMode>(
     }
     if (OPAQUE_TAGS.indexOf(tag) !== -1) return;
     // The element keeps its box, and nothing under it renders (`isSkippedContent`).
-    if (skipsContents(style)) return;
+    if (skipsContents(el, style)) return;
     for (const child of Array.from(el.children)) walk(child, nextParent);
     // A shadow root is part of what the user sees, so it is part of what the
     // model is shown. Walking the host's light children and its shadow tree

Limits: Chromium 159 and WebKit only. Firefox did not launch locally, and I did not run the full pnpm check or the web-benchmark crosscheck.

…lots by name

content-visibility: hidden skips nothing on a table, an inline table,
ruby, or an inline list item, as Chromium paints them, and a closed
<details> body laid out with ::details-content { display: contents }
renders, so both read visible. An HTML <button> or <fieldset> makes a box
of its own whatever its display, short of display: contents, so content
under one reads hidden. In SVG only an outermost <svg> has a box for the
property to act on: it skips whatever its display, and other SVG
elements, a nested <svg> included, ignore it.

In a closed root that assigns by name, slotOf finds an element's slot
from its slot attribute, the first HTML slot of that name, both read
outside any namespace, so a locator's read of one match never lists what
the slots hold. A root that assigns by hand still reads assignedElements().

isInClosedDetails asks whether a <details> folds its body before looking
for its summary, so an open one never looks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot removed the Ready for Human Review Green, conflict-free, every thread handled. Waiting on a maintainer. label Nov 21, 2026
@michal-e2e
michal-e2e requested a review from kdy1 November 21, 2026 13:29
@michal-e2e michal-e2e added the Ready for Human Review Green, conflict-free, every thread handled. Waiting on a maintainer. label Nov 21, 2026
@kdy1
kdy1 dismissed their stale review November 21, 2026 14:06

Reflected

@michal-e2e

Copy link
Copy Markdown
Collaborator Author

all good?

@okwasniewski okwasniewski left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm!

kblok added a commit to hardkoded/e2e-dotnet that referenced this pull request Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

e2e team Opened by the e2e team Ready for Human Review Green, conflict-free, every thread handled. Waiting on a maintainer. size:L Up to 499 changed lines, not counting tests, fixtures, translated docs, or the lockfile

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants