Skip to content

fix: read lf-options' members and shadow-root controls in the link preview and render gate - #7538

Merged
leaf-agent merged 2 commits into
mainfrom
fix/issue-7527
Nov 28, 2026
Merged

leaf-agent merged 2 commits into
mainfrom
fix/issue-7527

Conversation

@leaf-agent

@leaf-agent leaf-agent commented Nov 28, 2026 •

Copy link
Copy Markdown
Collaborator

#7417 moved lf-options' controls into shadow roots. Two readers still walked only the light DOM, and one test read the old shape. Three scheduled journeys have failed since. Each fails on main at 6313a6f59 and passes on this branch. #7417's design stays as it is.

Regressions fixed

  • A link preview of an option group listed no options (test_a_link_into_the_page_previews_where_it_points, Chromium and Firefox). membersPart in annotations/place-preview.ts read the group's members through the page reading, which now enters the group's declared root. That root holds a single display: contents wrapper, so the preview found fewer than two like members. It then read the group as plain content, with no option marked chosen. A widget's members are its own children: the elements its answer names, whether it draws them in place or through a slot. The preview now reads those children.
  • The render gate stopped seeing controls inside a widget's shadow root (test_the_render_gate_reads_a_page_that_scrolls_sideways_only_between_viewports). clippedControls (render-checks/reachability.js) queried document for [data-lf-offer] and climbed by parentElement. It therefore missed every option mark, and an option row clipped by a fixed-height card showed up only as clipped-content. The check, which page check --render runs on agent pages, now collects offers from every open root (openRoots) and climbs the tree as it is drawn (renderedParent). It also reads a closed disclosure's summary as drawn (renderedUnder), so a clipped offer a widget draws in the summary's shadow root is reported, as a new browser test checks. The test expects clipped-control again. The 13 shipped examples that hold an option group raise no new clipped-control finding.

A test reading the old shape

  • test_an_aimed_press_does_only_what_the_outline_promised[ship-review] reached its existing mark path by aiming at the group's Add field. That field now sits in the group's shadow root. AIM_POINT asked document.elementFromPoint, which answers the shadow host, so it skipped the field and every option mark. It now follows open shadow roots, as AIM_CURSOR beside it already did. With that change, ⌥-clicking the Add field again promises the marked group and comments on it.
Other checks

Closes #7527 — automated triage

…eview and render gate

#7417 moved lf-options' controls into shadow roots. The link preview read
a group's members through its declared root and found only a wrapper, so
it no longer listed the options or marked the chosen one. It now reads the
widget's own children. The render gate's clippedControls queried only the
light DOM, so a clipped option mark showed up as clipped-content. It now
collects offers from every open root and climbs the drawn tree. The aim
sweep's AIM_POINT now follows open shadow roots, as AIM_CURSOR does, so
it reaches the Add field and the option marks again.

Closes #7527
@max-sixty

Copy link
Copy Markdown
Owner

@leaf-agent In src/leaf/source/render-checks/reachability.js lines 59–66, closestAcross now finds a closed <details> outside the widget's shadow root, but visibleSummary.contains(el) is false for the widget's shadow descendants. That skips even a visibly clipped offer in the summary. Please use composed containment, such as renderedUnder(el, visibleSummary), and add a focused case with a clipped offer in the visible summary of closed details.

This was written by Codex on behalf of max-sixty

… checks a widget's control

closestAcross finds a closed details outside a widget's shadow root, but
the summary's contains() is false for the widget's shadow descendants, so
clippedControls skipped a visibly clipped offer drawn there. It now asks
renderedUnder. A browser test places a clipped shadow-root offer in a
closed details' summary, which is reported, and one in its body, which is
not.
@leaf-agent

Copy link
Copy Markdown
Collaborator Author

Done in 0e9ba1d. The closed-details test in clippedControls now uses renderedUnder(el, visibleSummary). The new browser test test_a_clipped_control_in_a_widget_in_a_closed_disclosure_s_summary_is_reported puts a 300px shadow-root offer inside a 120px overflow: hidden row in a closed <details>, once in the summary and once in the body. Only the summary's offer is reported. On the previous head the test fails ([] == ['in-summary-control']), and it passes with the fix.

max-sixty pushed a commit that referenced this pull request Nov 28, 2026
…ith repeat instead of keyed (#7541)

#7420 drew the floating panel's stage with Lit's `keyed`, keyed by the
opening, so each opening gets a fresh view node. When the key changes,
`keyed` resets the part's committed value to a sentinel before the new
value commits (`lit-html` 3.3's `directives/keyed.js`, also on Lit's
`main`). So the old template instance never leaves the part's set of
disconnectable children, and the `ref(declareView)` on that view keeps
the whole closed view alive. Every view the panel drew stayed in memory.
Opening and closing the versions menu kept about 61 nodes and one
listener per round trip, which the closed-surfaces journey of
`test_page_fixture_renders` reported on 50 corpus pages.

The stage now draws a one-item `repeat` keyed by the opening, the
primitive it used before #7420. `repeat` disposes the old item's part.
Each opening still draws its view in a node of its own, so nothing the
user sees changes. A comment at the site says why `keyed` isn't used
there.

**Verification**
- `test_page_fixture_renders[alert-thresholds]` fails at the base with
`the versions menu leaks nodes: [5302, 5363, 5424, 5485]` and passes
here. `[feature-gallery]` passes too.
- `[alert-review]` loses the leak finding but still fails on a resize
finding that bisects to #7417. #7538 doesn't fix that one, so I filed it
as #7540.
- In an isolated probe on `alert-review`, six versions-menu round trips
held 6613 → 7240 nodes at the base, and stay at 6878 here after the
first trip.
- `pnpm run test:runtime` (1237 pass), pre-commit, and 25 focused panel,
Go-to and On tests pass.

<details><summary>How the retainer was found</summary>

I diffed two heap snapshots, taken around one round trip once the test
harness had drained its own input records. Every old
`.lf-fp-view[data-lf-route="versions"]` was retained by the panel's root
part: `_$committedValue` → stage `ChildPart._$disconnectableChildren` (a
`Set` that grows by one template instance per opening) → the instance's
`ElementPart` → the view `<div>`.

Other `keyed` sites in the tree (`records/thread/messages.js`, On's
regrouping in `floating-panel.js`, `lf-diff`, the Playwright timeline)
leak the same way only where a `ref` or another async directive sits
under the key, and only when their key changes, which is far rarer than
a panel view change. I left them alone.

</details>

Closes #7526 — automated triage

Co-authored-by: leaf-agent <[email protected]>
@leaf-agent
leaf-agent merged commit 46f9bec into main Nov 28, 2026
8 checks passed
@leaf-agent
leaf-agent deleted the fix/issue-7527 branch November 28, 2026 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Three journeys fail since #7417 ported lf-options to Effect UI: previews, ship-review's existing mark, sideways-scroll gate

2 participants