Repository navigation
Hold the thread list's place through the native disclosure - #922
Conversation
Opening a panel thread closes the card that was open, and when that card is above it every title below comes up by its open height — the pressed title among them. The list already holds one card's place through every reflow its renders drive; native disclosure was a third reflow that took no hold, so what held the place was Chromium's own anchoring, which keeps whichever node it picked. Picked above the press, it holds room that did not change and lets the pressed title travel 186px, off the top of the scrollport from the first visible row. `toggle` arrives with the reflow already in the geometry, so the hold is taken on the way down, while the summary's activation is still a pending default action, and corrected on the frame that paints it. `takeScrollHold` already leads with the card under the pointer and then the card holding focus, which is the pressed card on either route into the press.
leaf-agent
left a comment
There was a problem hiding this comment.
The hold lands the title, but it now drops the landing that same press started, so a press on a title standing under a pinned run heading leaves it under the heading. land runs at pointerup and issues a smooth scrollIntoView (revealConversation, behavior defaulting to scrollBehavior()); holdThroughDisclosure writes threadsBox.scrollTop one frame later, and a scroll write cancels an in-flight smooth scroll. With motion enabled the landing never arrives. test_a_comment_the_pointer_lands_on_comes_out_from_under_the_run_heading does not see it: it builds its context with reduced_motion="reduce", so the landing is instant and complete before the click, and it presses the card's body rather than its title, so no disclosure reflow follows.
That is the invariant the landing rule exists for — COVERED_TOP returning None after a press — and this branch breaks it on the ordinary motion setting.
Measured, base against this branch
PANEL_PAGE with 8 comments in each of three sections, 1200×900, motion left at its default. Open the first card, scroll until a pinned run heading stands ~7px over a closed title below it, press that title with a real pointer, wait 1.2s, then read COVERED_TOP.
| runtime | buried before the press | after the press |
|---|---|---|
merge base 4486b34 |
6.8px | None — the title came out |
| this branch | 6.8px | Shipping offline editing covers it down to 7px in |
this branch, reduced_motion="reduce" |
6.8px | None |
The third row is the mechanism: with reduced motion the landing is instant at pointerup and there is nothing left for the correction to cancel. Separately, in the browser the suite drives, a box smooth-scrolling toward 1820 stays at 0 when a scrollTop write lands one frame in — the write cancels the animation rather than composing with it.
Underneath it, two owners now write this list's scroll inside one gesture — revealConversation's landing and the reflow hold — and the later one silently discards the earlier. The ownership table this PR edits names both (where the thread holding the focus stands in the list, the thread list's viewport position through reflow) without saying which wins when a single press moves both, and nothing lets the landing re-assert itself after a hold has corrected. By the same mechanism an arriving render's hold can cancel a landing already in flight — I did not reproduce that one; this change is what makes the collision fire on every title press.
Which way that precedence goes is a judgment call I would rather not make here, since the two candidates differ in what the reader sees:
- Re-assert the landing after
finishScrollHoldin the disclosure's frame. Keeps the smooth landing, but puts a second copy of the landing rule outsidelanding.js, including its "a drag for the thread's own words takes no landing" exception. - Make the press's landing instant —
landis described as a correction under the gesture rather than travel, and an instant correction composes with any later writer instead of being cancelled by it. One argument atland's call, and it covers the render collision too, but it also takes the motion off thefocusinlanding that sharesland.
Worth noting for whichever lands: the PR's new test tolerates abs=8 on the strength of that reveal happening ("a focus the run heading stands over is revealed out from under it by the list's scroll-padding"), and on this branch it does not, so the tolerance is currently covering the residual burial rather than the reveal.
The hold this branch adds is the later of two writers inside one press on a thread title: the press lands the thread out from under the pinned run heading at pointerup, then its click opens the thread and the hold writes scrollTop a frame later. `land` already states the order — the landing is a correction under the gesture and whatever the gesture asks for next wins — but a scrollTop write cancels a smooth scroll rather than composing with it, so the animated landing was dropped rather than superseded and the title stayed exactly where the heading covered it. So the press's correction is instant, which is also what lets the hold take its reference from where the landing put the title rather than from the band it was still leaving. The focusin landing has no such successor and keeps the shared behavior.
…the gesture (#982) "Keep the reader's place" had been fixed one surface at a time (#919, #922, #937, #946, #954, #955, #956, #971). The thread list had a good hold that no other surface could use. The Page Map restored its raw `scrollTop`, so a group arriving above the view pushed the rows the reader was on down by that group's height. The margin card relied on native anchoring. The panel's visible band was measured three different ways. Separately, `reveal()` took its reader intent when it was called, so an async caller that forgot to pass one got a late capture, and `lf-diff` moved focus and scroll after a network wait no matter what the reader had done since. ## What changed - **`runtime/reader-place.js`**: `placeKeeper(scroller, {items, identity})` holds one reference node's content offset through a mutation. It picks the reference from the pointer, then focus, then the visible band. It suspends `overflow-anchor` while the hold lasts, hands the place to whatever node a render put under the same identity, and follows a running fold. The thread list (keyed by thread id), the Page Map's `renderSheet` (keyed by `data-lf-map-key`), and the margin card's re-render of the same thread (keyed by event id) all use it. A node with an empty identity hands the place to the next candidate and is never matched to another node that also lacks one. - **`geometry.js`**: `visibleBand` (the shown band minus stuck `.lf-pinned` covers) and `landingBand` (minus the declared `scroll-padding`). Read acknowledgement, the thread card's being-read check, conversation landing, and anchor travel now read these instead of measuring for themselves. - **Reader intent**: `reveal(el, intent)` now requires the intent retained at the gesture and throws without one. `lf-diff`'s `stepHunk` and `nextUnreviewed` capture intent before they load a file, and land only if that intent still stands. `references/packages.md` states the contract. `scroll` is still not a cancelling input: the runtime's own landings fire it. `reader-intent.js` now lists the input that begins each way a reader can scroll. A probe confirmed that pressing a scrollbar fires `pointerdown` on the scroller. - **The #954 ordering rule is now the interface**: `chrome-layout.js` exports `takeShell(key)` in place of a frame that took a callback. A surface owner therefore has no way to render inside the frame that native anchoring depends on. ## Behavior that moved - With no pointer or focus to lead, the thread list's hold now uses the topmost visible card, which is what its header said. Before, it used the second. - A card entirely under a stuck heading no longer counts as visible. - The Page Map keeps the rows the reader was looking at, not a scroll offset. ## Tests - `tests/runtime/reader-place.test.mjs` covers candidate order, the clamp-aware correction, band insets, the identity hand-across, and an empty identity that must not hand the place across. Each hand-across case was checked by disabling the hand-across and watching the case fail. - `test_chrome_contracts.py` (everyday) gets a new Page Map continuity test. It fails against the base `page-map-dialog.js` (row moved 36px). The file also takes `test_taking_the_panels_strip_leaves_the_reader_on_the_same_words` from the nightly controls file. - `test_render_anchors.py` gets a nightly test: a hunk step still waiting on a file leaves a reader who has pressed elsewhere. It fails against the base `lf-diff.js`. - Local: `npm run test:runtime` 60 passed. A focused browser selection across margin, controls, widgets, projection, anchors, and chrome contracts: 142 passed. `test_render_navigation.py::test_pressing_a_page_mark_stands_in_the_thread_it_opens[long]` fails the same way on the unchanged base. > _This was written by Claude Code on behalf of max-sixty_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Opening a thread in the Threads panel can scroll the thread you opened off the top of the list. Press a title, the named
<details>group closes the card that was open, and if that card is above the press every title below it comes up by its whole open height — the pressed one among them. From the first visible row of a scrolled panel the title lands above the scrollport and the panel answers the press with the middle of a message and no title over it.The list already holds one card's viewport position through every reflow its renders drive (
takeScrollHold/finishScrollHold, leading with the card under the pointer and then the card holding focus). #905 made native disclosure a third producer of that same reflow — the only one the browser performs without a render — and it took no hold, so what held the place was Chromium's own scroll anchoring, which keeps whichever node it picked rather than the one the reader acted on. The first commit adds the hold to that third reflow and states in the module header and the ownership row inskills/leaf/assets/CLAUDE.mdthat the hold belongs to the reflow rather than to a call site, so a fourth producer is not missed the same way.togglearrives with the reflow already in the geometry, so the hold is taken on the way down — in a capture-phase listener on the list, while the summary's activation is still a pending default action — and corrected on the frame that paints it.That makes the hold the later of two writers inside a single press, and the second commit settles the order between them. The press also lands the thread out from under the pinned run heading at
pointerup, andlandalready states which wins — "the landing is a correction under the gesture, and whatever the gesture then asks for is later and wins" — but ascrollTopwrite cancels a smooth scroll rather than composing with it, so the animated landing was dropped rather than superseded and the title stayed exactly where the heading was covering it. The press's correction is therefore instant, which is also what lets the hold take its reference from where the landing put the title rather than from the band it was still leaving. Thefocusinlanding has no successor inside its own gesture and keeps the shared behavior.The disclosure jump, measured before and after
Ten placements on a 22-thread panel at 1440×900, varying which card was open, where the list was scrolled, and which visible closed title was pressed.
movedis the pressed title's viewport travel;visibleis whether it was still in the list's scrollport afterwards.movedvisiblemovedThe rows that do not reach 0 are the ones the scrollport has no room for: the list standing at
scrollTop0 or at its maximum cannot give back the room that closed. The base's compensation is Chromium's anchoring, which lands on the pressed title only when it happened to pick it or a node below it.Verification
Two browser cases in
tests/test_render_conversations.py, each reproduced against the merge base before it was written:test_opening_a_thread_leaves_its_title_where_the_reader_pressed_itpresses with a real pointer, asserts the closing card was above the press and gave back real room, and asserts the title stands where it was pressed and inside the scrollport. On the merge base:carried its title from 485.5px to 338.5px, 147px of room having closed above it.test_a_press_that_opens_a_thread_lands_it_and_holds_it_at_onceburies a closed title a few pixels under a pinned run heading with motion left at its default, presses it, and asserts both rules at once — the title comes out from under the heading and does not travel up past where the landing put it. With only the first commit:the press opened the thread but left its title under the heading: Shipping offline editing covers it down to 5px in. The existingtest_a_comment_the_pointer_lands_on_comes_out_from_under_the_run_headingdoes not see that case: it builds its context withreduced_motion="reduce", so the landing is already instant, and it presses a card's body, which opens nothing.tests/test_render_conversations.pyandtests/test_render_navigation.pytogether (248),npm run test:runtime(33),uv run pytest tests(1231 passed) andpre-commiton the changed files all pass on this branch. The five everyday-suite failures on this CI host — the fourAF_UNIX-dependent cases intest_interact_session.py/test_website_server.pyandtest_staged_writes_honor_umask_without_copying_a_replaced_symlink_mode— fail identically on the merge base here; the hosted runner is the control.Found by the weekly
/ui-sweep. The second commit answers the review on the first; of the two candidates it raised, this is the oneland's own stated order and the Motion rule inskills/leaf/assets/CLAUDE.mdpoint at, and it keeps the landing rule insidelanding.jsrather than putting a second copy of it beside the hold.