Skip to content

fix: preserve instant landings when a reading region opens - #4761

Merged
leaf-agent merged 1 commit into
mainfrom
fix/issue-4747-instant-landings
Oct 30, 2026
Merged

leaf-agent merged 1 commit into
mainfrom
fix/issue-4747-instant-landings

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

An instant landing on a saved trace element was missing the explicit scroll-choice marker used by smooth landings. When opening the tree also changed its layout, the scroll classifier introduced in #3772 treated that jump as layout's, so continuity restored the tree's older reading over the selected row. The shared landing function now marks both motions before scrolling. With reduced motion, the Saved element Moment keeps its row visible inside the tree and the page; ordinary motion and checkpoint reopening retain their behavior.

The existing reduced-motion regression fails on the base with the row at 784–840px outside a 228–408px band, and passes after this change. Both motion cases and checkpoint reopening pass, as do pane continuity in Chromium/WebKit, Firefox's native hidden-fold search, all 712 runtime tests, and pnpm run check. Base/candidate startup probes load 40 requests (36 code requests) through upgrade and server-state presentation, with 28 fewer code bytes in the candidate.

This is a partial repair. test_trace_tree_opened_by_the_browser_keeps_its_match still fails on the base and candidate: it opens the disclosure and scrolls through a script in the same task. The classifier deliberately treats a single script jump coinciding with changed layout as layout's. That simulation does not establish actual browser-find behavior; Chromium and Firefox window.find attempts did not open this trace disclosure. The remaining step is to reproduce through native find UI and establish the events it delivers before changing that classification. A full Chromium launch under Xvfb here fails before opening a page because its process-singleton socket is unavailable (Address family not supported by protocol); that check needs an environment supporting full Chromium's native window path. #4747 stays open for that work.

Refs #4747 — automated triage

Mark explicit instant landings as reader choices before scrolling, as smooth landings already are. This keeps reduced-motion trace Moments visible when opening the saved tree triggers continuity restoration. The scroll classifier introduced in #3772 otherwise reads that single jump during changed layout as layout-driven.

Refs #4747
@leaf-agent
leaf-agent merged commit 55ce1ef into main Oct 30, 2026
5 checks passed
@leaf-agent
leaf-agent deleted the fix/issue-4747-instant-landings branch October 30, 2026 09:42
leaf-agent added a commit that referenced this pull request Nov 5, 2026
…match (#5414)

When something other than the reader's click opens a closed `<details>`
and scrolls to a match inside it, Leaf now counts that scroll as the
reader's choice. Find-in-page does this. Before, continuity read the
scroll as a layout move and put the trace's Saved elements tree back
where the reader had left it, so the found row ended up out of view.
`test_trace_tree_opened_by_the_browser_keeps_its_match` failed on every
run. On current `main` it fails with the row at 480–535px, outside the
12–111px band where the tree shows rows. With this change it passes.

**Cause.** `scrolling.js` treats a single scroll jump as layout's when
the box's extent changed while it moved. It makes one exception: travel
into hidden content. Find-in-page signals that travel with
`beforematch`, but only for `hidden="until-found"` folds. When find
opens a `<details>` (the HTML ancestor-revealing algorithm), no
`beforematch` fires. Its `toggle` event arrives in a later task. So
opening the trace tree and scrolling to the row in the same frame looked
like a layout move. #4761 fixed the Moment landing by marking Leaf's own
instant landings. This is the browser-driven half that #4761 left open.

**Change.** A disclosure that opens without a click on its summary now
marks the same travel that `beforematch` marks, and for the same two
frames. A reader opening it themselves clicks the summary first, and the
click is dispatched before the toggle. The mark covers only the opened
disclosure and the boxes inside it. Leaf opens disclosures itself too:
`carry.js` carries one open across a revision while layout moves the
page around it, and the page's own scroll should still count as layout's
there. The `scrolling.js` header states the rule.

**Test basis.** As max-sixty decided in #4747, the repair is checked
against the test's scripted find: the test opens the disclosure, then
calls native `scrollIntoView`. It has not been checked against the
browser's real find bar, which headless Chromium doesn't have.

**Verification.**
- `tests/browser/test_render_playwright_trace.py`: both tree tests pass,
including checkpoint reopening, which confirms that a summary click
still restores the reader's place.
-
`tests/journeys/…::test_trace_moment_lands_its_saved_element_over_the_trees_reading`:
both motion cases pass.
- Neighbouring place-keeping tests pass: Firefox's closed-fold find, the
dial's folds, closing a fold in the floating panel, and a let-go into a
closed fold.
- `pnpm run test:runtime` (812 tests) and `pnpm run check` pass.

The browser-startup path gains two document-level capture listeners and
no requests.

Closes #4747

Co-authored-by: leaf-agent <[email protected]>
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.

1 participant