Skip to content

fix: keep the browser's scroll into a details it opens when the main thread is busy - #6726

Merged
leaf-agent merged 1 commit into
mainfrom
fix/issue-6303-details-opening
Nov 22, 2026
Merged

leaf-agent merged 1 commit into
mainfrom
fix/issue-6303-details-opening

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

Find-in-page opens a closed <details> onto its match and scrolls the match into view. scrolling.js marked that opening as the browser's own travel from the toggle event, which arrives in a task of its own. On a busy main thread the rendering update that ends the travel's scroll sequence runs before that task: instrumented under --cpu-throttle 16, the tree's scrollend came at 229 ms and toggle at 613 ms. The end then read as layout's, and continuity's shift restore (version.js restoreShifted → reading-place.js restorePlace) scrolled the tree back to where the reader had left it, losing the match. The opening is now read from a MutationObserver record on the open attribute, which is delivered before the next rendering update. The scope (document light DOM, <details> only), the click exclusion for a summary the reader activated, and the two-frame window are unchanged.

test_trace_tree_opened_by_the_browser_keeps_its_match, one of the macOS-only nightly failures in #6303, failed on every run under --cpu-throttle 16 on main and on the Nov 15 base, and passes 3 of 3 with this change. Unthrottled, the trace, reading-place, changes-in-place, contents and go-to tests that touch disclosures pass (84 passed), as does pnpm run test:runtime.

#6303 keeps two other cases: the settlement Home case and the Firefox send flash. Both passed in the Nov 21 nightly and are not touched here.

Refs #6303 — automated triage

…he browser's scroll into it

Find-in-page opens a closed <details> onto its match and scrolls the match
into view. scrolling.js marked that opening as the browser's travel from the
`toggle` event, which comes in a task of its own. On a busy main thread the
rendering update that ends the travel's scroll sequence ran before that task,
so the end read as layout's, and continuity's shift restore put the box back
where the reader had left it. The opening is now read from a MutationObserver
record on the `open` attribute, which arrives before the next rendering
update.

test_trace_tree_opened_by_the_browser_keeps_its_match failed on every run
under --cpu-throttle 16 (and on macOS nightlies) and passes 3 of 3 with the
change.

Refs #6303
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