Repository navigation
fix: open a sent comment's card where the box painted after a scroll in the same task - #6725
Merged
Merged
Conversation
…in the same task Chrome reports a box placed with CSS anchor positioning at its pre-scroll client rectangle for up to two frames after the page scrolls, while it paints where the scroll carried it. Send read the comment box's frame with getBoundingClientRect, so a send with no frame drawn since a scroll (as focusing the field can cause) handed the card a frame off by the scroll, and the card stood that far from its words until a later scroll re-placed it. In test_pins' seats test the card stood wholly below the window. floatingPlacement now reports how far the box's client rectangle stands from where its last placement stands it, measured from the anchor's box read now (`lag`), and the comment box's frame subtracts it. The new send-placement test scrolls in the Enter keydown that sends, and fails before this change (card 120 px off) and passes after. The seats test failed 3/18 copies on main with --cpu-throttle 8 and passed 36/36 with the change. Closes #6591
This was referenced Nov 22, 2026
Merged
leaf-agent
added a commit
that referenced
this pull request
Nov 22, 2026
…d's as painted Restores #6725's scroll compensation and its regression test, which the previous commit reverted, and keeps the handoff fix that revert bought. `fabFrameAt`, which Send reads through the exported `frame`, still subtracts `floatingPlacement.lag()`, so a comment sent in the task that scrolled the page opens its card where the box paints (test_a_send_in_the_task_that_scrolls_the_page_opens_the_card_where_the_box_stood). The handoff in `placeFab`, where saved state moves the box's attachment from quoted words to their subject, adopts the frame as its rectangles read: `lag` measures from the anchor's box read now, which that saved state has just moved, so it counted the move as a scroll and the open box jumped (test_saved_widget_words_cannot_dismiss_an_unfinished_comment). Refs #6734
leaf-agent
added a commit
that referenced
this pull request
Nov 22, 2026
…out the scroll lag (#6735) Keeps #6725's scroll compensation for Send, and stops the open comment box from jumping when saved state moves what it's attached to. That jump turned `test_saved_widget_words_cannot_dismiss_an_unfinished_comment` red on main for three of its cases (`widget`, `revision`, `dragged-revision`) in [run 44999105534](https://github.com/max-sixty/leaf/actions/runs/44999105534). #6725 added `floatingPlacement.lag()`, the comment box's client rectangle minus where its last placement stands it, measured from the anchor's box read now. `fabFrameAt` subtracts it so a Send in the task that scrolled the page opens its card where the box paints. `fabFrameAt` has a second caller, though: the handoff in `placeFab`, which adopts the seated editor's frame when saved state moves the box's attachment from quoted words to their subject. There the anchor moved because its content changed, not because of a scroll, so `lag()` counted that move as lag and the box jumped (247 px in the `widget` case) while the user was writing. **The change** (net against `main`, one file): the frame computation now takes the lag to subtract. `fabFrameAt`, which Send reads through the exported `frame`, still passes `lag()`. The handoff in `placeFab` passes zero and adopts the frame as its rectangles read, as it did before #6725. Both of #6725's behaviors and its regression test stay. **Verification** on the head `cf813f0fa`: - `test_saved_widget_words_cannot_dismiss_an_unfinished_comment` (all six cases) and `test_a_send_in_the_task_that_scrolls_the_page_opens_the_card_where_the_box_stood` pass: 7 passed. - With `fabFrameAt` also passing zero, the Send test fails with the card 120 px off, which is the injected scroll. So the test still guards the Send path. - `pnpm run check:browser` passes. Closes #6591. The previous commit on this branch reopened it while the branch reverted #6725; with #6725 kept, its second failure mode stays fixed. Refs #6734 --------- Co-authored-by: leaf-agent <[email protected]>
This was referenced Nov 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A comment sent with no frame drawn since a page scroll opened its thread card off by the scroll. Chrome reports a box placed with CSS anchor positioning at its pre-scroll client rectangle for up to two frames after a scroll, while it paints where the scroll carried it. Send reads the comment box's frame with
getBoundingClientRect(fabFrameAt), so the card adopted the stale offset ininitialHoldand kept it until a later scroll re-placed it. In the seats test intest_pins.py, focusing the field scrolled the window 297 px, and the card stood wholly below it with Resolve at viewport ratio 0. That is the second failure mode #6591 tracks.floatingPlacementgainslag(): how far the box's client rectangle stands from where its last placement stands it, measured at its held edges from the anchor's box read now. The anchor itself is not anchor-positioned, so its rectangle is current.fabFrameAtsubtracts the lag from the bar, the field and the field outline the card grows out of. A box in the window's plane has no anchor and no lag.Verification
test_a_send_in_the_task_that_scrolls_the_page_opens_the_card_where_the_box_stoodscrolls the page 120 px in the Enter keydown that sends. Without CPU throttling, it fails on main every time (the card opens at the box's pre-scroll top, 120 px low) and passes with the change. With the scroll set to 0 it passes on main, so the test isolates the scroll.uv run leaf-dev suite flake tests/browser/margin/test_pins.py::test_a_pass_for_a_change_to_the_rows_seats_them_as_a_whole_pass_would --cpu-throttle 8: 3/18 copies failed on main with Resolve at viewport ratio 0, and 36/36 passed with the change.pnpm run test:runtime(1080) andpnpm run check:browserpass.The thread card's grip drop (
carry.droppedinthread-preview.js) also adopts a client rectangle, but that rectangle comes from a drag rather than from reading the box in the task that scrolled, so this change leaves it alone.Closes #6591 — automated triage