Repository navigation
Keep a sent comment's words in place as its thread card grows out - #2985
Merged
Merged
Conversation
…carrying the box Pressing Send used to measure the comment box (its width, writing measure, height, inner scroll and Send's room) and carry those numbers into the new thread card, whose first message wore them until the card closed, while a clip-path animation grew the card out of the box. Five modules and a block of frame rules held that carry, and fractional zoom kept breaking it. The box and the card now share the geometry by construction, so nothing is carried: - One text column. Both start the words `--lf-thread-text-inset` inside the field's or transcript's edge and end them `--lf-comment-text-end` (Send's hit box and its inset) inside it, on every line. The comment box holds Send's room as padding rather than after its last line, and every message in a margin card ends its words at the same inset. On desktop the box's lines lose 17px and card messages 30px of measure; under a finger nothing changes, since both already held Send's room on every line. - One scroll end. A card Send opened stands its transcript at the end (`showArrival`), and a comment box reveals its caret's whole line inside its `scroll-padding`, so a draft typed to its end rests at its true end too. Measured on triage-board (short, multi-line and scrolled drafts; 1280 and 390 wide; zoom 1.1; touch), each word stands within 0.07px of where it was typed, as with the carry. The grow-out animation is gone: it needed the box's measured frame. Tests: test_send_grows_thread_around_the_words again checks every word's position through Send (the carry's attribute, endRoom mode and inner-scroll checks go), and the compact-comment, rewrite and zoom tests stop asserting the carried frame and the animation's clip. The diff-controls journey dresses the one new token. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…kens The previous commit dropped Send's grow-out because it clipped from the comment box's measured rect. The box's frame and the card already share their corner, height and text column, so the clip can open from tokens instead: the field stands the frame's insets (`--lf-comment-frame-top/inline/bottom`) inside the card, and a CSS animation on the card (`data-lf-grows`) opens `inset()` from those to the card's edge over 240ms, as the measured version did. The card is whole and live beneath the clip, so no word moves and presses reach it throughout. The one dimension the frames did not share was width: the box rested at 242px, the card at its 320px minimum. The box's minimum is now the card's (`--thread-card-min`, capped by the same room), so the clip starts on the field's right edge too. A resting comment box is 78px wider than before. Reduced motion skips the growth; the card simply replaces the box. A view transition (the browser morphing box into card) held the words still too, but it holds the page's paint for two to three frames after Send, leaves the card unpressable while it runs, and lets the server's reading land before the gesture's first frame. Tests: test_send_grows_thread_around_the_words also asserts the card played its growth (it fails with the growth disabled). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts: # skills/leaf/kernel/kernel.json
…ivery #2959 reserved a short editable margin message's one-line rewrite height only once the message carried Edit, which arrives with delivery. With Send no longer carrying the comment box's frame into the card, every one-line comment card then grew 10px when "Sent" arrived, and a card holding its foot while sending moved its words up 10px. Reserving the room for any turn of the user's from its first paint keeps both the delivery and the rewrite still. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
reviewed
Oct 15, 2026
leaf-agent
left a comment
Collaborator
There was a problem hiding this comment.
A long draft scrolled away from its end jumps to the end on Send. showArrival always calls scrollToEnd for a sent card, while the removed frame carry preserved the editor's scroll position. In a 900 × 600 browser reproduction, I scrolled the draft to 0 with a scroll limit of 1771 px, then pressed Ctrl+Enter; the new card opened at 1771 px. The words the user was reading disappear, despite the PR's word-placement guarantee. Preserve the draft's visible reading position across Send, and cover a draft scrolled away from its end in the Send test.
… its end The review found that a long draft the user had scrolled back through jumped to its end on Send: the card always opened at its transcript's end. The box and the card share their text column and their foot, so the box's distance from its end (`fromEnd`, carried with the frame the card already adopts) places the card's words where the box showed them, at the end or anywhere above it. Tests: test_send_grows_thread_around_the_words gains a draft scrolled back to its start (it fails without this change). The smoke test for reading keys in a submitted comment now reads the card's transcript, which is that comment's viewport since the first message no longer scrolls on its own. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
approved these changes
Oct 15, 2026
leaf-agent
added a commit
that referenced
this pull request
Oct 15, 2026
The sent-drawing browser case now reads its retained scroll from the thread transcript. #2985 intentionally moved a long sent comment's scrollport from the first message to that transcript, but this case still required an inner `.lf-msg-text` scrollbar and failed on the new layout. The test continues to check the drawing-reference behavior introduced by #2136: the reference follows the comment text, the message body does not clip it, and it remains inside the visible transcript after a long card is resized. Its short phone and long desktop variants both pass with the transcript as the scrollport. Verification: both focused browser variants pass; Ruff format and `git diff --check` pass. The long variant failed at the old inner-scroll assertion before this change. Co-authored-by: leaf-agent <[email protected]>
max-sixty
added a commit
that referenced
this pull request
Oct 18, 2026
…ving room (#3064) A one-line comment's sent margin card is now as tall as the comment box it came from (148 px, against 158 on main), and nothing in it moves when "Sent" arrives or when its rewrite opens. ## Why the card was taller Every user message in a margin card kept room from its first paint for the reply box's taller rewrite field (#2959, moved to first paint in #2985), whether or not the user ever opened the rewrite. Delivery itself needs no room, since "Sent" and the Edit control already stand in the message's head. ## What changes - **The card's rewrite is the comment box the card grew from.** Its frame and padding fit the 5.5 px each card line already keeps, and its words end at the card's text column, so opening it on plain words moves none of them and changes no height. On main, a two-line comment rewrapped to one line in the wider editor and the card shrank 11 px. Markdown still opens as its source, which can be longer than the drawn message, as on main. Outside the margin card the rewrite still matches the reply box, as #2813 decided. - **The card's rewrite field is 10 px shorter than the reply field below it.** The user chose this over matching the reply box, which would make the card grow 10 px when a rewrite opens. - **`skills/leaf/assets/AGENTS.md` states the principle.** Hold room before first paint only for what will be drawn. Hold no empty room for a state that may never come, however likely; show it in a slot already on screen and let the user's gesture make the room it needs. ## Tests The card cases of `test_a_rewrite_is_the_reply_box_where_the_words_stood` and `test_a_rewrite_of_a_comment_just_sent_is_the_reply_box` now assert that the message keeps its height and its words their line, in place of the field matching the reply box's height and padding. Ran, after updating from main (which moved these tests to `tests/browser/threads/test_rewrites.py`): that file, `tests/browser/margin/test_card_reply.py`, `tests/browser/margin/test_card_placement.py`, `tests/browser/test_render_send_placement.py`, `tests/browser/test_render_aim.py`, `tests/browser/threads/test_composing.py`, and `pnpm run check:browser`. All pass. > _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.
Pressing Send turns the comment box into the new thread's margin card without moving a word, and the card still grows out of the box. The box and card now share a text column and placement rule, replacing the earlier carry that pinned the first message to measured width, writing measure, height, inner scroll, and Send room. Send still carries the box's placement and its distance from the editor's scroll end, so a draft scrolled back from its end opens at the same lines.
What users see
data-lf-grows) opens a clip from the field's edges to the card's over 240 ms. The field's edges are the frame's existing size tokens (--lf-comment-frame-top/inline/bottom), so nothing is measured. The card is whole and pressable under the clip.--thread-card-min), so the clip starts exactly on the field's right edge.--lf-comment-text-end, which is Send's hit box plus its inset). The box keeps Send's room on every line, not only after the last one, and card messages end at the same inset. Touch is unchanged, since it already reserved Send's room on every line.showArrival). The box and the card share their text column and their bottom edge, so the box's distance from its end, carried with the frame the card already adopts, places the card's words where the box showed them. That holds whether the draft rests at its end or the user scrolled back through it. The field's caret reveal now includes the caret line's leading and itsscroll-padding, so a draft typed to its end rests at its true end.Why not View Transitions
I tried a view transition first: the box and the card shared a
view-transition-name, and the morph held the words still (0 px in every captured frame). I dropped it for three reasons:Size
Against main (
git diff --numstat):Word displacement on Send
Settled positions are measured from layout with
leaf-dev probe --base. Mid-animation positions compare the pixels of each frozen frame (0/60/120/180 ms and settled) against the draft.Markdown drafts still reflow on Send, since the message renders what the draft shows as markup. A rendered table can also make the card narrower than the box, so the clip then starts left of the field's right edge.
Tests
test_send_grows_thread_around_the_wordsagain asserts every word's position through Send, and now also that the card grew. It fails with the shared end inset removed (7 of 8 cases) and with the growth disabled.endRoommode, or the measured clip were trimmed to what they still protect.test_reading_keys_follow_a_submitted_comment_s_viewport) now reads the card's transcript. Since the first message no longer scrolls on its own, the transcript is that comment's viewport.Ran on the merged tree:
tests/smoketests/browser/test_render_send_placement.pytest_render_threads.pyandtest_render_projection.pytest_render_aim.py::test_a_compact_comment_carries_its_box_into_the_inline_threadtest_render_margin.py::test_a_sent_comment_keeps_its_text_viewporttest_chrome_contracts.py::test_send_room_moves_to_every_line_only_while_the_field_scrollstest_render_outbox.py::test_a_comment_field_scrolled_away_and_back_is_still_thereThat is 82 tests, all passing.
pnpm run test:runtimepasses 493/493 andpnpm run check:browseris clean. On main before the last commit here,test_send_grows_thread_around_the_words(three cases) errors on the same 10 px delivery move.