Skip to content

Grow a thread card down as you type in it, and keep a send from scrolling the page - #7082

Merged
max-sixty merged 10 commits into
mainfrom
thread-card-grows-down
Nov 25, 2026
Merged

max-sixty merged 10 commits into
mainfrom
thread-card-grows-down

Conversation

@max-sixty

@max-sixty max-sixty commented Nov 24, 2026 •

Copy link
Copy Markdown
Owner

A thread card beside its words now keeps the top of its reply box still while you write in it, where it kept its foot. The words you type grow the card down, and an answer arriving still grows it up, so neither moves the line the draft starts on or the turn it answers. Under the foot hold (#5537), each line a draft gained lifted the card's head and every turn, and a card at the window's head, standing there or waiting there beside a section scrolled part out of the window, scrolled the turn being answered out of its transcript while room showed below.

The placement states that as one rule: a surface names the line it keeps still (keeps: its top, its foot, or a line of its own a stated distance above its foot), and heldTop in comment-placement.js stands it by one formula where each edge had its own. What stands over the line grows the surface up and what stands under it grows it down.

It also stops a send from scrolling the page. On main, with a six-line draft and the card's head 45 px under the window's, Enter scrolled the page 178 px: the send's landing read the card after its new turn was laid out and before its placement stood it. A floating surface whose size has changed since its placement stood it is now judged when that placement lands.

A card keeping its reply box's top is capped by a height that counts the reply box, so the cap changes as the draft does. A transcript that scrolls therefore carries its own share of that cap. Without it, the layout that took a line from the draft gave the line to the transcript before the placement lowered the cap, and in Firefox and WebKit that left the reader a line short of the transcript's end, with the next answer under the reply box. The third browser test below runs in Firefox for this, with the reader at the transcript's end.

To weigh: the card's header records that on 5 November the maintainer chose its rule as the platform's, scroll anchoring keeping a focused text field still, and #5537 carried that out by holding the card's foot. This holds the top of the reply box instead, after his questions on 24 November about a card that kept its foot as he typed and about a canonical rule for it, and he chose to merge it on 25 November. The line being typed, and Send under it, now move down a line with each wrap, where they stayed at one height. Four catalogue states draw the card lower for the same reason: plan-card-reply, plan-card-reply-long, plan-card-reply-photo and plan-card-reply-error.

Tests: a unit test stands a surface by its own line through a draft's lines, a turn joining, the window's head holding it in, and a card that fills its room. Three browser tests type a wrapping reply beside a section taller than the window: with the card at its own spot and a send after it, with the card waiting at the window's head, and in a card an answer has filled to the window's head, where a line and a picture come and go. Each fails on main at the first wrap, and with the fix it protects removed. Three tests that stated the foot hold take the new line. Runtime code: 118 lines added and 67 removed, comments aside.

This was written by Claude Code on behalf of max-sixty

…ling the page

A thread card beside its words now holds the top of its reply box while
you write in it, where it held its foot. The words you type grow the card
down from that line, and an answer arriving still grows it up, so neither
moves the line the draft starts on or the turn it answers.

The foot hold (#5537, 5 November) kept the typed line still as an answer
arrived above it. A card holds one edge for every cause of growth, so a
line of the draft grew it up too: the head and every turn rose a line per
wrap, and a card whose head stood at the window's scrolled the turn being
answered out of its transcript while room showed below, which the user
reported from a page on 24 November. #5537 recorded that cost.

`heldEdge` in `annotation-overlay/thread-preview.js` still asks for the
foot while the user writes beside the card's subject. The card now also
says, at every placement, how much of it its reply row takes
(`underReply`), and `commentPlacement` holds the line that far above the
foot (`under`): each landing records the amount, and the next placement
stands the foot lower by as much as it has grown. The solve at the size
the card last stood, which box-motion reads as where the page carried the
card, holds the spot as it landed.

Emptying the box yourself no longer leaves it above where it began, so
the header drops that rare-path exception.

A send could scroll the page on main. The sent turn is laid out from the
card's foot until the card's placement lands, and with the card's head
within that growth of the window's, the send's landing
(`thread/reply-landing.js`, `sendLanding`) read the card past the
window's head and brought its section back: 178 px, measured with a
six-line draft and the head 45 px under the window's. A floating surface
now says while its size has changed since its placement stood it
(`resizing` in `off-flow.js`, from `resized` in `floating.js`), and is
left to that placement, after which `keepThreadLanding` lands in it
again.

Behavior, measured with `leaf-dev probe` in Firefox and Chromium at
1600x1000 against main, on a card beside its words:

- A line of the draft wraps: nothing above the reply box moves and the
  card's foot drops 21 px, where the head and every turn rose 21 px.
- Six lines with the head 14 px under the window's: the foot drops 147
  px and nothing scrolls, where the transcript scrolled 125 px with 420
  px free below the card.
- An answer arriving while the user writes still grows the card up by
  the answer, the reply box staying.
- Send, at the reply box's foot, now moves down a line with each wrap.
- Above or below its words a card grows as before, and near the
  window's foot the window still lifts it.

Tests: `test_a_growing_draft_beside_its_words_holds_the_editor_s_top` is
new, and fails on main at the first wrapped line and, with `resizing`
answering false, at the send.
`test_open_reply_keeps_its_first_line_after_card_moves_to_right_rail`
(was `..._keeps_its_foot_...`),
`test_margin_card_holds_its_top_while_read_and_its_reply_while_written`
and the margin case of
`test_native_reply_edits_after_semantic_paint_keep_the_first_line` take
the new edge.
leaf-agent
leaf-agent previously approved these changes Nov 24, 2026
…rom moving the draft, and replay a bring-back once the card is placed

Review of the first commit found three things.

A line-held card that the boundary's head holds in, as one beside a section
scrolled part out of the window is, read its room from where its row stands,
above the window, so each typed line still came out of its transcript. Its
cap now rises by what has grown under its line, as far as the boundary's
height.

The line was the reply row's top, and the row's first track is the shelf of
pasted pictures, so a picture pasted mid-draft moved the words down. The line
is now the reply field's top: a picture lifts the turns, as an answer does.

A surface mid-resize skipped its bring-back, which only a thread landing
replayed. It now answers with the landing of the placement that stands it
(`standing`), and every bring-back is judged then.

Tests: test_a_growing_draft_in_a_card_the_window_s_head_holds_grows_it_down
is new and fails without the raised cap, and the re-seat test also asserts
what only the beside rule does, an answer growing the card up.
A card whose entry is gone starts no placement, and its landing promise then
waits for whichever placement next lands. The card now answers off-flow's
`standing` only where its placement started, and is otherwise judged as it
stands.
leaf-agent
leaf-agent previously approved these changes Nov 24, 2026
A card capped at the boundary's head kept the tallest height it had stood at,
which included the longer draft, so a line taken from the draft gave that
height to the transcript and the boundary pushed the card, line and all, down
by it. The tallest is now kept of what stands over the line. A card the grip
carries no longer starts a placement for a bring-back.

Tests: test_a_full_card_s_draft_keeps_its_first_line_as_lines_and_a_picture_come_and_go
is new; it fails with the tallest kept whole, and with the line measured at
the reply row's top, under a pasted picture.
leaf-agent
leaf-agent previously approved these changes Nov 24, 2026
max-sixty added a commit that referenced this pull request Nov 24, 2026
`tests/journeys/margin/test_card_placement.py::test_an_open_card_takes_news_without_moving_its_controls`
clicked the card's reply box while a step's arrival still carried the
reply row down (300 ms). Playwright's reveal of its target then scrolled
the page 420 px before the click landed, with no scroll of Leaf's, and
the test's last assertion compared controls read off the window with
where a later click brought them back.

It failed eight runs in nine alone on a Mac, two of them on main's
runtime, and two of three inside a parallel run; it passes when the
carry has ended by the click, so the daily run may show it only now and
then. The test now waits for the card to rest before the click, as its
sibling in `test_render_margin.py` does; with the wait it passed nine
runs in nine, four of them on main's runtime.

Found while working on #7082, which doesn't cause it.

> _This was written by Claude Code on behalf of max-sixty_
leaf-agent
leaf-agent previously approved these changes Nov 25, 2026

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not blocking: three comments outside the diff still send the reader to heldEdge in thread-preview.js, which this PR renamed to keptLine. They are the browser/runtime/thread/replies.js header ("the edge the card holds asks only whether the user is typing words in its reply box (heldEdge)") and the two thread-preview.js, \heldEdge`pointers inbrowser/runtime/thread/thread-card.js, one in the header beside endNewsMoves()and one in the comment above the floating-card growth check. Each should namekeptLine` and the line the card keeps, not the edge it holds. I can push that if you'd like.

A card that keeps its reply box's top is stood by its foot and capped as a whole, and that cap counts the reply box, so it changes with every line the draft gains or loses. The layout that takes a line from the draft runs before the placement that lowers the cap. With the transcript scrolling, that layout gave the line's height to the transcript, the browser clamped the transcript's scroll, and the placement then took the height back, all within one frame. No size observer saw the transcript change, so the end keeper never put its reader back: in Firefox and WebKit a reader at the transcript's end was left a line short of it, every turn stood 21 px lower, and the next answer arrived wholly under the reply box with no notice. Chromium's scroll anchoring hid it. An independent review of this branch found it on 24 November 2026; main, which holds the foot and caps the card by a room the draft doesn't change, never had it.

While the card keeps that line, a transcript that scrolls now carries its own cap: its share of the card's, the cap less everything else the card holds. The line a draft loses then shortens the card in the layout that takes it, and the placement only moves the card. The card keeps its own cap too, so its other tracks still share it once the transcript has no more to give, as a picture pasted over the line needs: with the cap on the transcript alone, that picture moved the line 14.5 px.

test_a_full_card_s_draft_keeps_its_first_line_as_lines_and_a_picture_come_and_go now runs in Firefox as well, with the reader wheeled to the transcript's end, and reads the first turn and the distance to the end after each edit. Its Firefox arm fails without the share (the first turn at -189 against -210).

Comments that named `heldEdge` name `keptLine`, which replaced it.
leaf-agent
leaf-agent previously approved these changes Nov 25, 2026
max-sixty added a commit that referenced this pull request Nov 25, 2026
…eck the layers (#7119)

Moves each top-level child of `browser/runtime/` into a directory for
its import layer, and rewrites the dependency-cruiser layering check
(#7113) to name 11 layers in place of an order of 187 children. A module
imports only its own layer and the layers below it. The layering, drawn
from today's imports, leaves 2 imports pointing up, against 15 for the
best flat order, so the known list drops from 15 entries to 2. No
behaviour changes.

| # | Layer | Directory |
|---|---|---|
| 0 | Entry points and diagnostics | top level of `runtime/` |
| 1 | Floating panel, page dialogs and page keys | `panel/` |
| 2 | Annotation presentation, composing and undo | `annotations/` |
| 3 | Application and widget host | `host/` |
| 4 | Page features: annotation inventory, contributions, version travel
| `features/` |
| 5 | Records and history | `records/` |
| 6 | Page readings, places and paint | `readings/` |
| 7 | Transport, errors and notices | `transport/` |
| 8 | DOM, geometry, focus and the key register | `dom/` |
| 9 | State and registry | `state/` |
| 10 | Primitives and the library | `base/`, and `lib/` where it was |

**What stays put.** The entry points (`bootstrap`, `prepaint`,
`check-api`, `validation`, `widget-api`, `portable-api`,
`stage-integration`, `age`) and `lib/` keep their paths, since pages,
packages, the server and the render checks load them by served path. So
do the files that aren't modules: `chrome.css`, `marks.css`,
`panel-row.html` and `kernel-registry.json`, which the server and Python
read at their served paths. A child directory keeps its name inside its
layer, as in `dom/keyboard/`.

**How the paths moved.** The first commit is the move with `git mv` (all
271 renames detected) and the path rewrites. A script resolved every
relative and served-path specifier in the old tree and wrote the
target's new path; other references in Python, configs, the build, tests
and guidance followed. The primitives' eslint rule now names each
primitive's neighbours by the relative path from its own place. Eval
fixtures, pinned GitHub permalinks and the example diff in
`worktree-diffs.html` keep the paths they recorded. The second commit
rewrites the check and adds "Import layers" to `browser/AGENTS.md`. A
later commit gives the new path wherever guidance, comments or tests
named a moved top-level module by its bare filename (`focus.js` →
`dom/focus.js`), which had also been its path under `runtime/`; a
sibling in the same directory keeps its bare name, and a basename code
compares keeps it too.

**The two upward imports** in `.config/dependency-cruiser-known.json`:
`host/application.js` → `annotations/undo.js`, and
`host/sample-child.js` → `annotations/composing/page-image.js` (a lazy
import).

**What to check.**
- The framework's facade stays excluded from the graph by its served
path, now `/runtime/records/framework.js`, as #7113's config already
did. Twelve modules below `records/` import it that way, and
`state/semantic-state.js` reaches the record folds through its
`createSemanticApplication`, so the check doesn't see that route from
`state/` up to `records/`.
- Open PRs that touch runtime files, #7082 and #7132, need `main` merged
in; git's rename detection carries most of their edits to the new paths.
- `test_each_sampled_focus_ring_is_shown_whole_in_its_surface`
(journeys) runs here because the PR touches its file, and fails as it
does on `main`. One of its six faults is real: since #7091, an opened
settled decision's mark stands as tall as its row, so its ring runs
under the next row. The other five are the check reading a transparent
click target as paint over the ring. #7129 fixes both. The move doesn't
cause it.

Tests: `pnpm run check` (type checks, `test:runtime` 1130 pass, build
and worker tests), `pnpm run build:browser` (no generated file changed),
the prepared kernel build (same 68 outputs as base), pre-commit on every
changed file, `tests/smoke`, the model tests for served runtime modules
and public modules (`test_module_url_delivery`,
`test_revision_delivery`, `test_distribution`, `test_interact_layer`:
318 pass), `test_owner_index`, the prepared-install journey in
`tests/journeys/test_distribution.py`, and `leaf-dev probe alert-review
--base`: the page boots, the panel draws the same label, with the same
317 requests and no console output on either arm.

> _This was written by Claude Code on behalf of max-sixty_
# Conflicts:
#	browser/runtime/annotations/annotation-overlay/thread-preview.js
#	browser/runtime/records/thread/replies.js
leaf-agent added a commit that referenced this pull request Nov 25, 2026
… draft (#7182)

Since #7082, a thread card keeps its reply box's top still and grows
down as its draft changes; before, it kept its foot. So when Backspace
takes a line from among the draft's words, the lines under the removed
line now rise 21px, one line, in the frame the key lands, where layout
puts them.
`test_a_line_removed_among_the_words_moves_only_what_layout_moved[card]`
still expected the foot-standing card's behaviour, every word drawn
where it stood in that first frame, so it failed on Linux and macOS in
both Chromium and Firefox.

The card now gets the comment box's expectation, since #7082 made both
stand on their top. That expectation used to be waived (`composer ==
"comment" or not jumped`). Now it is asserted: on a box standing on its
top, the removal's first frame draws each word where it comes to rest,
so the words after the line arrive in one step and never travel there.
The panel still stands on its foot and still has to draw each word where
it stood. The test's jerk check and its "the removed line moved some
words" check are unchanged.

Verification: on current main (`32dc564a8`) the two `card` cases fail
with the issue's diff (`words 11 … (618.5, 597.5)`, `words 12 … (639.5,
618.5)`). With this change, all six cases of the test (card, comment and
panel, each in Chromium and Firefox) pass in three runs. That includes
the comment box under the stronger assertion.

Closes #7175 — automated triage

Co-authored-by: leaf-agent <[email protected]>
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.

2 participants