Repository navigation
Keep a page thread's reply box on the band's foot across sends - #2895
Merged
Merged
Conversation
A send from a thread's reply box in the page's flow, on a widget's seat or a diff line, now leaves the box on its pixel, with the new turn drawn above it. Before, the first send lifted the box 9px on a seated thread and 13px on a diff thread, and the send that made the thread taller than the reading band dropped it back by the same, in Chromium and WebKit. Escape from a box onto a thread the user sees no longer moves it either. Cause: two landings aimed different lines. Typing brings the reply row's foot to the reading band's foot. The send then landed the whole thread nearest while it fitted, and the send had just focused the thread, whose focus ring asks `--focus-ring-room` (5px) of scroll margin; with the thread's padding under the row (4px seated, 8px in a diff), the box rose by that much. Once the thread no longer fitted, the landing aimed at the reply row instead, which put the row's foot back on the band's foot. `standOnThread` (`landSent`) also landed the focused thread nearest before the turn drew, the same 9px. Change: - `sendLanding` (reply-landing.js) reads the box before the send draws. A box the user saw whole, in flow, is put back where it stood once the turn has drawn; a pinned row, a separate transcript, or a box out of view still land the thread as before. replies.js reads it before `sendReply`. - `holdBox` and the send share one hold (`returnTo`), which reads the box as though each scroller stood at its aim (`aimedTop`) and moves through `moveScrollerBy`, so repeated holds don't add rounding. - `standOnThread` doesn't scroll a thread the user already sees. Why the shift watch missed it: the watch measures in layout coordinates, which remove scrolling (shift_watch.js, "Scope"), and both moves were scripted scrolls inside the send gesture's own rendering. Test: `test_sends_from_a_page_threads_box_move_it_only_by_the_turns_they_add` (seated and diff threads, Chromium and WebKit) sends until the thread is taller than the band, and fails on main at the first send (-9px seated, -13/-14px diff). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Review of the first change found that holding the box's top on every send carried a Threads panel card's earlier turns, and every card above, up by each new turn even with room below (the transcript is a declared append region), and that a box emptied of several lines lifted its foot, where Send and the caret stand, by the lines it lost (60px in a diff thread, where main moved it 13px). `sendLanding` now follows the row's foot: the box goes down by what the turn adds, less what the emptied box gives back, until its foot meets the band's foot, the line typing keeps it within (`revealWritingArea`); a foot already past that line stays where it stood. On the reported case the foot stays on the band's foot through every send, in Chromium and WebKit. The panel card with room below behaves as on main again. Tests: the page-thread test now reads the row's foot and adds a four-line diff case (renamed `test_sends_from_a_page_threads_box_hold_its_foot_at_the_bands`); `test_a_panel_send_with_room_below_moves_only_the_box` guards the panel's append behaviour. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The append region lets the idle reply row move by the transcript's growth; where that growth would carry a row the user just sent from past the landing band, the row stops at the band's foot and the scroller takes the rest (sendLanding). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
approved these changes
Oct 14, 2026
max-sixty
added a commit
that referenced
this pull request
Oct 25, 2026
…#3921) The shift watch compares positions in layout coordinates, which remove scrolling, and credits every move inside a gesture's rendering to that gesture. So when Leaf scrolled during a gesture, the control under the user's aim moved on screen and no test failed: before #2895, a send scrolled the window 9px and the reply box went 9px up the screen while its page position, which is all the watch compared, stood still. ## What the watch checks now Each press or key has an aim: the control a press lands on, or the one holding focus for a key. Through the gesture's rendering the watch reads the aim fresh in viewport pixels, beside the scroll offsets of the boxes that carry it, and reports `gesture-scrolled` where a scroll carried it on screen. A scroll may hold the control still, or take back part of what the gesture's own layout moved it, as the #2895 send landing does once the reply row reaches the band's foot, but not carry it further. - Exempt: a command that takes the user somewhere declares `travels` on its register row, and the dispatcher's `lf-command-invoked` carries it to the watch, so no list lives in the watch. A link's activation and a key the page leaves to the browser (Tab, Space, arrows) are exempt by the platform's own meaning, and wheels and drags aim at nothing. - Attribution: a scroll counts only where the gesture's own work called a scrolling API (focus without `preventScroll` included), which `input_work_watch.js` names the input of. A call from work no input owns during the rendering, as a test's script scrolling the page, leaves the gesture unjudged. A first version without this blamed a test's `scrollIntoView` on the click before it. - Known gap: a scroll begun where the input's source is lost, after a native `await` or in an observer's delivery, goes unjudged. The margin card's room-making scroll (`makeRoom`) is one; the Stability contract allows it anyway. `travels` is declared on the walks and scrolls (`t`, `m`, `d`/`u`, `j`/`k`, align, `n` search steps, row walks that scroll, tab walks, the command reference's list, diff hunk and file steps, visual review cases), Go-to's destinations and hint choices, first unread, Resume writing, `c`, which goes to the box it names, and a board card's keyboard move and its cancel. ## Landings it caught, now fixed - Escape from a page thread's box, onto a thread that fits but whose head the user had scrolled above the window, scrolled the head back and carried the box 49px down (`returnToThread`, formerly `standOnThread`). A box that still stands in front of the user now keeps the thread where it is; a send that gave its box up, as a seat does to the thread it starts, still brings the thread into view. - Show or Hide on a thread summary landed the whole thread and lifted the toggle 20px in Chromium, 27px in WebKit. `scrollThreadIntoView` now leaves a control the user already sees where it is; a reply row pinned to its scroller's foot still lands the thread's end. - The Threads list's landing: nothing caught in the panel list tests. ## Cost At `--cpu-throttle 4`, the watch's frame callback averaged 23.6 and 23.1 ms before and 23.3 and 23.4 ms after, over five watched tests interleaved, which is inside the run-to-run spread (`notes/shift-watch-cost.md`). ## Tests - `test_a_scroll_during_a_gesture_may_not_carry_its_control` covers a press and a key that scroll, the hold, the take-back, a travelling command, a key left to the browser, and a passive scroll inside the rendering; the two scrolling cases fail with the judgement disabled, and the passive one fails without the attribution. - `test_escape_from_a_box_leaves_it_where_it_stood` fails on main by 49px; the summary test now checks its toggle, failing on main by 20px and 27px. - `test_sends_from_a_page_threads_box_hold_its_foot_at_the_bands` now watches shifts. With the send landing reverted to landing the thread, the watch reports the reply box moving 11px and 16px. - Forcing the watch onto unsurveyed tab and merge-film tests still reports pointer presses; `TODO.md` lists them, since a press has no command to declare `travels`. > _This was written by Claude Code on behalf of max-sixty_ Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
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.
Closes Lit follow-up item #91, "a page thread's reply box moves after a send".
Behaviour that changed
A send from a thread's reply box in the page's flow (on a widget's thread seat or a diff line) now keeps the box's foot, where Send and the caret are, on the reading band's foot. It stays there through the send that makes the thread taller than the band. A box with room below still moves down by the turn it adds, as before. Escape from a box onto a thread the user can see no longer moves it.
Before this, in Chromium and WebKit, the first send lifted the box 9px on a seated thread and 13–14px on a diff thread. The send that made the thread too tall dropped it back by the same amount. That breaks Stability in
skills/leaf/assets/AGENTS.md: "A state change may repaint any box but must not move controls next to the gesture that caused it". It also breaks the append-region allowance, which lets the idle reply row move only by the transcript's growth, while here the box moved against it.Cause
Two landings aimed at different lines:
revealWritingArea).landSent), and the focused thread asks--focus-ring-roomof scroll margin. While the thread fitted, the send landed the whole thread nearest, so the box rose by the ring room plus the thread's padding under the row.standOnThreadmade the same landing before the turn drew.The shift watch missed it because it measures in layout coordinates, which remove scrolling (
tests/shift_watch.js, "Scope"). Both moves were scripted scrolls inside the send gesture's own rendering.Change
sendLanding(thread/reply-landing.js) reads the reply row's foot before the send draws.replies.jsnow takes that reading beforesendReply.holdBoxand the send share one hold (standingAt/returnTo). It reads throughaimedTopand moves throughmoveScrollerBy, so repeated holds add no rounding.standOnThreadno longer scrolls a thread the user already sees.skills/leaf/assets/AGENTS.md, Stability, gets a sentence on which rule wins when a sent turn is taller than the room below the box: the row stops at the band's foot and the scroller takes the rest. The append-region text alone didn't settle it.Line deltas
Tests
test_sends_from_a_page_threads_box_hold_its_foot_at_the_bandscovers a seated thread with one-line replies and a diff thread with one-line and four-line replies, in Chromium and WebKit. It fails with main's runtime on the first send, by 9, 13 and 14px.test_a_panel_send_with_room_below_moves_only_the_boxchecks that a Threads panel card with room below keeps the list still and moves the box by the turn.test_render_threads,test_render_margin,test_render_drafts,test_render_floating_panelandtest_render_navigation;test_chrome_contracts;pnpm run test:runtime.test_a_rewrite_is_the_reply_box_where_the_words_stood[card]fails both with and without this change (main's runtime, f281604).