Repository navigation
Keep Threads messages in place as conversations move - #1045
Conversation
leaf-agent
left a comment
There was a problem hiding this comment.
Following an arriving reply is gated on an 80px tolerance below the conversation's last message, and the composer this PR grows is taller than that — so the feature switches itself off in the state it exists for. With the panel open and the list scrolled to its end, an empty reply box leaves the last message 68.7px above the fold and the arriving turn follows; one line of draft text leaves it 98.7px above the fold, and the same arriving turn does not move the list at all — it lands 114px below the fold. The two halves of this PR meet here: the CSS takes the reply textarea from 40px to 69.5px as soon as :placeholder-shown stops matching, which is the whole of that 30px.
The constant is standing in for the room the card's own trailing chrome takes below the last message, which is not a constant. Substituting the card's measured tail for the 80 is not enough either — I tried it, and the list's own end padding leaves it ~5px short. What the guard is actually asking is whether the reader is at the end of the list, and the scroller states that directly; the inline suggestion is the form I tested.
Second, a reply that grows past the panel's height now pulls the reader backwards. scrollIntoView({block: "nearest"}) aligns the element's start edge when the element is taller than the scrollport, so a long streaming answer jumps the reader to the top of the message it was following: measured scrollTop 654 → 1161 with 1189px of the new text still below the fold, and the follow then stops, because the message's bottom is no longer anywhere near the band. With these three files at the merge base the place is simply held (654 → 654), so this is the growth path moving the reader further from the newest words than doing nothing would. block: "end" aligns the end edge unconditionally and keeps the newest words at the fold.
Third, and smaller: padding-inline: 7px drops the Send icon's reserved horizontal band that .lf-compose-field > textarea:not(.lf-fab-input) sets (padding-inline-end: calc(var(--lf-icon-action-hit) + 12px), shadow.css). The block-end reservation only clears the last line, so a draft long enough to scroll the textarea — it caps at max-height: 50vh — runs its own words under the Send disc while the reader scrolls back through them. That invariant was what the rewritten docstring in test_a_thread_keeps_submit_in_its_field_and_resolve_with_its_metadata used to hold.
How the first two were measured
Both against this head in the merged checkout, LONG_PAGE with a root comment and 14 agent replies, panel open, reduced motion, then readAndApply() after appending the event — the arrangement test_incoming_reply_follows_a_thread_at_its_latest_message already sets up. The draft case adds page.locator(".lf-thread[open] .lf-compose textarea").fill("A short follow-up.") before scrolling to the end; the growth case appends an edit of ~120 repetitions of a sentence to the newest reply.
Both suggestions were run against tests/test_chrome_contracts.py -k "incoming_reply_follows or another_threads_reply", which stays green with either applied, and the draft case follows again under the first one (the new reply's bottom lands at 830 against a fold at 835).
leaf-agent
left a comment
There was a problem hiding this comment.
The follow is admitted on how much scroller is left, but the landing it performs aligns the message, so the rule cannot survive its own first move. Measured immediately after an arrival follows, unseen is 94 — the room the card's tail and the list's end padding take below the last message — and 94 is over the 80. Streaming is where that bites: after the first reply follows, five successive growths of that same reply are each refused, the list stays at scrollTop 609, and the answer's last line ends 4262px down against a fold at 830. The reader ends up further behind the newest words than they were before the reply arrived, which is the case the rule exists for.
The same reading also switches the feature off entirely for a conversation that is not the last card in the list. With four later conversations below the open one, and the reader parked exactly at the foot of the conversation they are reading, unseen is 230: nothing follows, and the arriving reply lands 114px below the fold.
unseen is mine, from the previous round, and it is the wrong quantity. It asks how much scroller is left when what the landing controls is where the message's end sits, and anything standing below that message — the composer, the card's trailing chrome, later cards — opens a gap between the two. That gap is the room the constant has been standing in for across 80 → 2 → 80, which is why widening it moves neither case. geometry.js already names the fold the landing uses: landingBand is "the shown band less the scroll-padding the scroller declares, which is also what scrollIntoView honours". Reading the previous last message's bottom against that fold makes the admission a fixed point of its own landing, and leaves the 80 meaning what the commit title says — nearby — instead of standing in for chrome it cannot know.
The suite is green because both growth steps in test_incoming_reply_follows_a_thread_at_its_latest_message re-pin the list to its end first (el.scrollTop = el.scrollHeight, then -= 40). Removing those two lines from the growth step is the streaming case above.
Measurements and how they were taken
All against head 97056244 in the merged checkout, LONG_PAGE with a root comment and 14 agent replies, panel open, reduced motion, readAndApply() after each appended event — the arrangement test_incoming_reply_follows_a_thread_at_its_latest_message already sets up. fold is the list's bottom less its scrollPaddingBottom.
Streaming — scroll to the list end, append one reply, then five edit events growing it, with no scroll in between:
| step | scrollTop | unseen | last message bottom | fold |
|---|---|---|---|---|
| after arrival | 609 | 94 | 830 | 830 |
| after growth 2 | 609 | 1186 | 1922 | 830 |
| after growth 3 | 609 | 1771 | 2507 | 830 |
| after growth 4 | 609 | 2356 | 3092 | 830 |
| after growth 5 | 609 | 2941 | 3677 | 830 |
| after growth 6 | 609 | 3526 | 4262 | 830 |
Open card not last — same conversation plus four later root comments, the open card scrolled so its last message's end sits at the fold:
| step | scrollTop | unseen | last message bottom | fold |
|---|---|---|---|---|
| before | 495 | 230 | 830 | 830 |
| after the reply arrives | 495 | 344 | 944 | 830 |
With the two suggestions applied, streaming holds the newest words at the fold through every growth (scrollTop 609 → 1701 → 2286 → 2871 → 3456 → 4041, last message bottom 830 at each step), the non-final card follows (495 → 609, bottom 830), and tests/test_chrome_contracts.py -n0 -k "incoming_reply_follows or another_threads_reply or keeps_submit_in_its_field or arrivals_keep_open_panel_drafts or focus_mark" is 7 passed — including this head's -= 40 line.
Separately: tests/test_render_conversations.py::test_the_line_offers_the_list_its_own_keys_rather_than_the_way_deeper_in fails here, but it fails identically with this PR's three runtime files reverted to the merge base, so it is not this branch's.
leaf-agent
left a comment
There was a problem hiding this comment.
Both hold at e9c0f49b. Streaming keeps the newest words at the fold through successive growths with no repin between them, and a selected conversation with later cards below it follows again — the two cases I measured last round. uv run pytest tests/test_chrome_contracts.py -n0 -k "incoming_reply_follows or another_threads_reply or keeps_submit_in_its_field or arrivals_keep_open_panel_drafts or focus_mark" is 8 passed.
One case is left, and it is the shape of my own suggestion. The guard now admits the conversation's end anywhere in the band, but the landing aligns unconditionally, so a reader who has scrolled forward past the open conversation to read the cards below it gets pulled back into it. With 30 later conversations and the open card's last message ending 591px above the fold, an arriving reply takes the list from scrollTop 1086 to 629 — 457px backwards — although that reply was already whole where the reader was (top 255, bottom 373, against a fold at 830). At the ordinary four later cards it is 96px, and there too the reply was already fully on screen before the landing moved it.
A turn arrives or grows below the words the reader is on, so the follow only ever needs to carry them forward. Reading that off the landing rather than the admission — move only when the newest words have gone below the fold — holds the place in both cases while every case the tests name still lands at the fold, and it leaves the guard's top bound doing what it says: dropping a reader who has the conversation off the top, where a reply taller than the panel would otherwise pull them forward instead. The module header's "visible near the bottom of the panel" then describes the rule the code runs.
Measurements and how they were taken
Against head e9c0f49b in the merged checkout, LONG_PAGE with a root comment and 14 agent replies, then N later root comments; panel open, reduced motion, the open card's last message parked with scrollIntoView({block: "start"}) so the reader is on the cards below it, readAndApply() after appending one reply. fold is the list's bottom less its scrollPaddingBottom (830); the band starts at 181.
| later cards | last message's end before | scrollTop |
with the suggestion |
|---|---|---|---|
| 4 | 600 | 725 → 629 (back 96) | 725 → 725, reply at 616–734 |
| 30 | 239 | 1086 → 629 (back 457) | 1086 → 1086, reply at 255–373 |
The suggestion was run against the same eight-case selection above — 8 passed, including this head's growth loop and the new later-cards case — and through pre-commit's prettier and eslint hooks on the file.
leaf-agent
left a comment
There was a problem hiding this comment.
The backwards pull is gone at 37bef8c8: both cases I measured last round hold their place, and the landing now only runs when the newest words have gone below the fold.
The new trailing-interval clause refuses the follow in one case it shouldn't, though — when the reader is already at the end of everything the panel has to show. tailEnd < band.bottom - FOLLOW_ROOM reads the card's end standing above the landing edge as "the reader scrolled forward past this conversation", but the other reason it stands there is that the list had nothing more to put below it. With one conversation and one reply the panel isn't even full (scrollHeight === clientHeight, card end 426 against a fold at 830); a long answer then arrives and nothing moves — scrollTop stays 0 and the newest words end at 2708, 1878px below the fold. The same arrangement followed at e9c0f49b (0 → 1878, newest bottom 829.5). It is the reader parked at the list end too: with four later cards below the open one and scrollTop at the list's end, the card's end sits 135px above the fold, so a long reply lands 1815px below the fold and the list does not move.
Distinguishing the two is one reading the scroller already answers — whether the reader is at the list's end, where there is nothing they could have moved onto. The inline suggestion is the form I tested; it leaves FOLLOW_ROOM meaning what its two other uses mean, distance the reader has put between themselves and the fold.
Measurements and how they were taken
Against head 37bef8c8 in the merged checkout, panel open, reduced motion, readAndApply() after appending one reply of ~120 repetitions of a sentence. fold is the list's bottom less its scrollPaddingBottom (830); the band starts at 181.
Panel not full — LONG_PAGE with a root comment and one short agent reply, no scroll (scrollHeight - clientHeight is 0), card end 426.1, last message end 331.6:
| head | scrollTop |
newest message's end |
|---|---|---|
37bef8c8 |
0 → 0 | 2707.5 |
e9c0f49b |
0 → 1878 | 829.5 |
merge base 525ff4ca |
0 → 0 | 2707.5 |
| with the suggestion | 0 → 1878 | 829.5 |
At the list end — a root comment with 14 agent replies plus N later root comments, el.scrollTop = el.scrollHeight before the arrival:
| later cards | card end before | 37bef8c8 |
with the suggestion |
|---|---|---|---|
| 4 | 694.8 (fold 830) | 725 → 725, reply ends at 2644.7 | 725 → 2540, reply ends at 829.7 |
| 30 | -189.2 | 1609 → 3653, reply stays at -283.3 | same — the conversation is off the top of the band, and that movement is the list hold keeping the later cards in place |
The merge base does not follow in either arrangement, so neither is a regression against main; both are the case the PR's own summary names.
The suggestion was run against uv run pytest tests/test_chrome_contracts.py -n0 -k "incoming_reply_follows or another_threads_reply or keeps_submit_in_its_field or arrivals_keep_open_panel_drafts or focus_mark" — 9 passed, including both new later_cards parameters — and through pre-commit's prettier and eslint hooks on the file.
leaf-agent
left a comment
There was a problem hiding this comment.
The unfilled-panel case this commit is for still fails once anything stands below the open conversation. contentEnd reads the list's last child, but the clause it feeds compares the open card's end, so the collapsed cards between the two eat the FOLLOW_ROOM slack a card at a time: at three later conversations (34px each, against 80) the guard refuses again. With the panel not scrollable at all — scrollHeight - clientHeight === 0, every card on screen, the reader having scrolled nowhere — the arriving reply lands 181px below the fold and the list does not move. test_incoming_reply_follows_when_the_panel_has_unfilled_room puts no later cards under the conversation, so it passes on the one arrangement where the reading works.
What separates the two states is the thing the case is about: the card's end can only stand above the landing edge because the reader moved where the list gave them somewhere to move to. An unfilled list shows every card at once and has moved nobody. Qualifying the trailing clause on that answers both, and drops the :nth-last-child query and edge with it — the inline suggestion is the form I ran.
Second, "scrolling into later cards keeps the reader's place" is not what happens when the open conversation is what grows. In test_a_later_cards_reader_stays_at_the_list_end's own arrangement the last later card sits at 796.8–830.8 before the reply and at 3172.7–3206.7 after it: scrollTop is unchanged and nothing the reader was looking at is still on screen. The place hold anchors on the open card, whose top does not move while its body grows, so the later cards are pushed 2376px down under a stationary viewport. The merge base does the same (695 → 695, last card to 3173.2), so it is not a regression — but declining to follow there protects nothing, and the test's name and the description both state an outcome the code does not deliver. The quantity that case needs is the reader's own anchor, and that lives in the place hold's reference choice rather than in this guard.
Measurements and how they were taken
Against head 6b9ccf71 in the merged checkout, LONG_PAGE, panel open, reduced motion, readAndApply() after appending one reply of ~120 repetitions of a sentence. fold is the list's bottom less its scrollPaddingBottom (830).
Unfilled panel — a root comment with one short agent reply, plus N later root comments; scrollHeight - clientHeight is 0 in every row, so nothing has been scrolled:
| later cards | card end before | scrollTop |
newest message's end |
|---|---|---|---|
| 0 | 426.1 | 0 → 181 | 830.0 |
| 2 | 426.1 | 0 → 181 | 830.0 |
| 3 | 426.1 | 0 → 0 | 1011.0 |
| 4 | 426.1 | 0 → 0 | 1011.0 |
| 3, with the suggestion | 426.1 | 0 → 181 | 830.0 |
| 8, with the suggestion | 426.1 | 0 → 181 | 830.0 |
At the list end with later cards — test_a_later_cards_reader_stays_at_the_list_end's arrangement, probing the last later card's box rather than only scrollTop:
| head | scrollTop |
last later card, before → after |
|---|---|---|
6b9ccf71 |
725 → 725 | 796.8–830.8 → 3172.7–3206.7 |
merge base 525ff4ca |
695 → 695 | 797.3–831.3 → 3173.2–3207.2 |
The same measurement with focus taken out of the open card (document.activeElement.blur() before the scroll) is unchanged, so this is the hold's reference choice rather than the test's arrangement.
The suggestion was run against uv run pytest tests/test_chrome_contracts.py -n0 -k "incoming_reply_follows or another_threads_reply or keeps_submit_in_its_field or arrivals_keep_open_panel_drafts or focus_mark or later_cards_reader" — 11 passed, the same 11 as this head, including both new cases — and through pre-commit's prettier and eslint hooks on the file.
leaf-agent
left a comment
There was a problem hiding this comment.
One conversation standing above the open card switches the follow off. With a root comment, one short agent reply, and one earlier root comment above it, the panel is not even scrollable — scrollHeight - clientHeight is 0, every card on screen, nobody has scrolled anywhere — and a long arriving reply lands with its newest words at 2741 against a fold at 830 while scrollTop stays 0. Remove that earlier card and the same arrival follows (0 → 1878); put it below instead and test_incoming_reply_follows_when_the_panel_has_unfilled_room's new later_cards=3 parameter passes. So the case the commit before this one was for is still reachable, from the other direction, and the thirteen-case selection below is green at this head.
The cause is which quantity hold?.reference is. placeCandidates' lead is inherited || named[0] || visible[0], and it is chosen so a reflow correction has some anchor — the topmost thing on screen is a fine anchor and says nothing about which conversation the reader is in. Of the three, only named, the visible item under the pointer or holding focus, is a statement about the reader: visible[0] is the list's own top-down order, and inherited is whatever a hold still standing on a fold was anchored to. Reading the hold is the right altitude — it is where "where is the reader" lives, and it is what let this commit drop the :nth-last-child content-edge reading — but the field to read is what the user named, with an empty answer meaning nobody named anything, which is the landing band's question to settle rather than a refusal of its own. The inline suggestions are the form I ran: the hold publishes named, and the guard refuses only when the reader named a different card. Both intent parameters of test_a_later_cards_reader_stays_at_the_list_end and both later_cards parameters hold with them applied.
The rule the case turns on has no test at either boundary. shown is what admits or drops a pointer or focus candidate, and tests/runtime/user-place.test.mjs can reach it — placeKeeper is already driven there against a laid-out DOM, in a node the render replaced hands the place across under its identity. Instead the file's new assertion goes to placeCandidates with named: ["d", "c"], which is the shape named: ["c", "a"] two assertions above already pins, and it replaced the off-screen-focus case that shown is the removal of.
Second, smaller and independent: wheel in pointer.js's remember writes the rounded coordinates the module exists to exclude. Read back through the shipped module, pointerAt() is {x: 120.5, y: 240.25} after a pointermove to that point and {x: 120, y: 240} after a wheel at the same place — WheelEvent is a MouseEvent, so it carries exactly the "client coordinates ... rounded away from the point the browser hit-tested" that the comment above the listener rules out. It stays rounded until the next pointermove, and modifier aim does not wait for one: aimedTarget reads pointerAt() on the keydown on purpose, because "the answer cannot wait for them to jiggle the mouse first", so holding ⌥ after a scroll resolves the promise from the rounded point. The wheel is here for its timeStamp, so recording only that keeps both readings.
Worth weighing while you are in here: that timestamp makes "which input last named the user's place" a fact with no owner. user-intent.js already listens on pointerdown, keydown, input, wheel and touchstart, and its header states the reason in the same terms — "a wheel or trackpad is wheel, a touch scroll touchstart, a key keydown". This commit adds a second reading of that fact in pointer.js and a third in user-place.js, whose new focusin/keydown pair puts a document-wide keystroke listener in the scroll-place module. Its counter cannot rank pointer against focus, so it is not a drop-in; but one owner for the last input's kind and time would leave pointer.js holding only a position, and would be where the input and touchstart routes it already knows about get answered too.
Measurements, and how they were taken
Against head d859dc3c in the merged checkout, LONG_PAGE, panel open, reduced motion, readAndApply() after appending one reply of ~120 repetitions of a sentence. The open conversation is a root comment with one short agent reply, opened by pressing its summary; N earlier root comments stand above it; the reader is parked with the open card's own last message landed at the edge (scrollIntoView({block: "end"})), focus blurred and the pointer off the list. fold is the list's bottom less its scrollPaddingBottom (830), and scrollHeight - clientHeight is 0 before the arrival in every row.
| earlier cards | scrollTop |
newest message's end |
|---|---|---|
| 0 | 0 → 1878 | 829.5 |
| 1 | 0 → 0 | 2741.5 |
| 2 | 0 → 0 | 2775.5 |
| 1, with the suggestions | 0 → 1912 | 829.5 |
| 2, with the suggestions | 0 → 1946 | 829.5 |
Hovering the earlier card instead of blurring gives the same two refusals at this head, and keeps them under the suggestions, since the reader has then named that card.
Selection, with the suggestions applied: uv run pytest tests/test_chrome_contracts.py -n0 -k "incoming_reply_follows or another_threads_reply or keeps_submit_in_its_field or arrivals_keep_open_panel_drafts or focus_mark or later_cards_reader or selected_thread_before_later" — 13 passed, the same 13 as this head, including every new parameter; and npm run test:runtime — 77 passed. The pointer reading is pointerAt() itself, imported through window.__lfRuntimeImport('/runtime/pointer.js') after a mouse.move(120.5, 240.25) and then a mouse.wheel at that same point.
leaf-agent
left a comment
There was a problem hiding this comment.
Separately from the hold?.reference reading in my other review on this head, and on different lines: the end of the list is the one scroll position the follow refuses, and it is where a reader waiting for a reply sits. With the panel scrolled to its end at d859dc3c, an arriving reply does not move the list — scrollTop stays 589 and the new message lands 20px below the fold. Step back 20px first and the same reply follows. Sweeping that step: 0, 5 and 10 refuse; 20 through 160 follow; 200 refuses, correctly, because that is reading history. test_incoming_reply_follows_a_thread_at_its_latest_message steps back 40, inside the window, so the suite does not see it.
6b9ccf71 followed at the end (589 → 609, newest words at the fold), and reverting only thread-list.js to it — keeping this commit's user-place.js and pointer.js — restores that, so the place hold is not what changed here. The change is edge: threadsBox.scrollHeight > threadsBox.clientHeight asks whether the list can scroll, but what holds the last message away from the fold is the card's own tail — its composer, now with Send on its own row, plus the card's chrome. In this arrangement that tail is 94.5px against a FOLLOW_ROOM of 80, and at the list end no scroll position makes it smaller, so bottom < edge - FOLLOW_ROOM refuses exactly where the reader is most certainly at the newest words.
That tail is the quantity this guard has been standing a constant in for through every round, and it is one the card can state directly. 6b9ccf71's tailStart/tailEnd pair named it; this commit traded it for a list-wide reading that cannot see it, and the unfilled-panel case it was reaching for is the same tail measured where the list has not scrolled. Keeping the tail and qualifying only its trailing clause on scrollability answers both in one reading.
Measurements and how they were taken
test_incoming_reply_follows_a_thread_at_its_latest_message's own arrangement, with its el.scrollTop -= 40 replaced by the step below: LONG_PAGE with a root comment and 14 agent replies, panel open, reduced motion, A short follow-up. in the composer, el.scrollTop = el.scrollHeight, then one appended reply and readAndApply(). The fold is the list's bottom less its scrollPaddingBottom, 830; the band starts at 180.7. Before the arrival the last message's bottom is 736.3 and the card's is 830.8 in every row below — the 94.5px tail — so the only thing that varies is what the guard makes of them.
At the list end, no step back:
| runtime | scrollTop |
newest message's bottom |
|---|---|---|
d859dc3c |
589 → 589 | 850.2 |
6b9ccf71 |
589 → 609 | 830.2 |
d859dc3c with only thread-list.js at 6b9ccf71 |
589 → 609 | 830.2 |
d859dc3c with the suggestion |
589 → 609 | 830.2 |
The step back from the list end:
| back | d859dc3c |
with the suggestion |
|---|---|---|
| 0 | 589 → 589 | 589 → 609 |
| 5 | 584 → 584 | 584 → 609 |
| 10 | 579 → 579 | 579 → 609 |
| 20 | 569 → 609 | 569 → 609 |
| 40 | 549 → 609 | 549 → 609 |
| 80 | 509 → 609 | 509 → 609 |
| 120 | 469 → 609 | 469 → 609 |
| 160 | 429 → 609 | 429 → 609 |
| 200 | 389 → 389 | 389 → 389 |
The later-cards arrangements are unchanged by it: in test_a_later_cards_reader_stays_at_the_list_end's setup with neither focus nor hover on a later card, scrollTop holds at 725 on both runtimes, and with either intent the later card stays at 796.7 on both.
uv run pytest tests/test_chrome_contracts.py -n0 with the suggestion alone is 37 passed. It also composes with the other review's suggestions, which sit on the lines above and below it: with all of them applied, the back-sweep follows at 0 with the newest words at the fold, -k "incoming_reply_follows or another_threads_reply or keeps_submit_in_its_field or arrivals_keep_open_panel_drafts or focus_mark or later_cards_reader or selected_thread_before_later" is 13 passed, and npm run test:runtime is 77 passed.
leaf-agent
left a comment
There was a problem hiding this comment.
e227cf97 closes the list-end case: with the panel scrolled to its end and an eight-line draft standing under the conversation, the arriving reply lands at the fold, and reverting only thread-list.js turns the new browser case red.
What is left is the module header, which still states the rule from two commits ago, inverted on the point those commits turned on. "follows only while the list's place hold names that conversation" excludes the case d0dc58e4 exists for — the hold names nothing and the follow runs, which is what test_incoming_reply_follows_when_the_panel_has_unfilled_room's earlier_cards=1 and later_cards=3 parameters pin. And "its previous last message is visible near the bottom of the panel" is no longer where that message has to be: it only has to stand inside the landing band, and it is the card's own tail that has to reach the edge. skills/leaf/assets/AGENTS.md sends a reader of this module to its header for the local contract — "Read each module's header for its local contract" — so that paragraph is what someone arriving at incomingAtLatest has already been told, and what it tells them is that the follow needs an explicitly named card. The comment above FOLLOW_ROOM is accurate on both points; the suggestion is the header saying the same thing.
|
The standing approval is on the current head, and I am not withdrawing it — but the follow refuses in an ordinary arrangement, and it is the one a reader waiting for an answer is in. With the list scrolled to its end, nothing named, and three collapsed cards below the open conversation, an arriving reply lands 386px below the fold and
The repository already states the rule the other way, and implements it. The form I ran, against // Only a reader who had somewhere to scroll on to can have left this conversation
// behind, so the trailing edge is read against their own scroll rather than the
// content standing below it (bounds.js, on a block bounded at its end).
const moved =
threadsBox.scrollHeight - threadsBox.scrollTop - threadsBox.clientHeight > 2;
if (
tailStart < band.top ||
tailStart > band.bottom + FOLLOW_ROOM ||
(moved && tailEnd < band.bottom - FOLLOW_ROOM)
)
return null;Seven rounds in, it is the guard's geometry I would hold with less confidence rather than this reading in particular — each round has traded one quantity standing in for the card's trailing chrome for another. Landing as it stands and taking this as its own change is a fair call: Measurements and how they were takenAgainst head
Stepping 200px back from the list end with 4 later cards follows either way, and at 30 later cards the conversation is off the top of the band either way, where the movement is the list hold keeping the later cards in place. Gates at |
…#1112) The run headings pinned in the Threads list reserve their height through `--lf-head-room`, which a ResizeObserver writes. A heading first declared while the panel was shut had measured nothing, so for the frame after the panel's first opening the list's `scroll-padding` held no room for it. A landing in that frame put the thread under the pinned heading. On macOS, `test_pressing_a_page_mark_stands_in_the_thread_it_opens[long]` clicked a page mark inside that frame and landed 25px short of the band. The defect predates #1045, which exposed it: #1045 made the composer 2px taller, and the list stopped reaching its scroll limit, the one case the check excuses. `landingInsets` now measures any cover that is shown but has not yet been measured while shown, so every landing reads the room before the observer's first report. This replaces the one-off measurement a host's first declaration made (`geometry.js`, `declareCoverRoom`). Three browser tests read chrome with a one-shot evaluate that raced the repaint following a key press. Each now waits for that frame: - `test_ask_actions_replace_unusable_package_binding_badge_faces`: the Ask's binding shortcuts. It failed whenever the browser was already warm. - `test_the_thread_walk_stays_inline_until_threads_is_opened`: the walk position taking the notice's place. - `test_an_ask_under_the_open_panel_is_shown_beside_it_or_by_clearing_it[1280-False]`: badges replaced between the count and the box read. Evidence, macOS, paired runs of this branch and main (85e1030) at six concurrent copies: - The thread-walk, badge-faces and page-mark tests together: main 4/30 runs failed, this branch 0/30. - The open-panel Ask test: main 6/24 failed, this branch 0/24. Serially on main, `[long]` fails every run and badge-faces fails whenever another test runs first. Every one of these cases now passes. Run on this branch, the navigation, widgets, conversations, margin, anchors and chrome-contract files had one failure, the open-panel Ask flake above, which this PR fixes. `npm run test:runtime` passes. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
…e page (#1784) Typing in a floating comment box scrolled the page whenever the box stood under or over its passage and grew past the room shown on that side. On every content change, `floating-response.js` asked `makeRoom` to scroll the reading region until the whole box fit clear of the passage. A stack-logged probe at 900x700 measured it. With the box over its passage at mid-window, the first keystroke scrolled the page 162px. With the box under a passage near the top, the page scrolled 55px once the box reached the window's foot. The user's rule is that the box moves and the page stays. The comment box's height may now reach the whole boundary on every side, as it already could beside its passage, and growth never spends scroll travel. It grows from the edge that holds it (#1890 holds a landed box by that edge). Once the window stops that edge, shift slides it over its passage, and once it fills the window it scrolls its own words. This is what a box beside its passage already did at the window's foot. Only a thread card opening under or over its target still scrolls to make room. The margin card's reply never scrolled the page while typing; the same probe confirmed that at both widths. Letting the box fill the window exposed a 2px mismatch at Send. The box reserved 2px less beneath its words than the card's reply row takes, so a card capped at the window's height shrank its transcript and shifted the sent words up 2px (`test_send_grows_thread_around_the_words` at 900x600). One token, `--lf-comment-reply-row`, now sizes both. Behavior changes the tests now protect: - `test_typing_moves_the_comment_box_and_leaves_the_page_still` (new) types line by line into a box under and over its passage and checks that the page never scrolls and the box stays in the window. Both cases fail on main. - `test_a_growing_text_comment_keeps_its_side_and_the_page_still` (was `..._keeps_its_passage_clear_without_changing_sides`) and `test_a_text_comment_chooses_above_when_the_page_has_more_room_there` asserted that typing scrolled the page and kept the passage clear. They now assert that the page stays put, and that a later scroll carries the grown box with its passage. - `test_a_wheel_return_attaches_the_comment_box_in_the_first_visible_frame` types a shorter draft. In its pane cases, typing used to scroll the pane to make room under the passage, and the test expected the box there. - `test_where_a_comment_stands_before_and_after_send`'s phone case required the box to overlap its block only when the two couldn't show together, which only held while typing scrolled the page. It now requires a box that overlaps to stand at the window's edge. The assets AGENTS.md "Stability" section now says a floating box grows inside the window and never scrolls the page for its growth. A field in flow, which cannot move apart from the page, still keeps its controls in view. ## Add-on F: one shared reading of where the user works The design review proposed one reading of the user's working point, shared by the card's held edge (`holding`, fed by `drafting` in `margin-projection.js`), the place keeper (`recentPlaceInput` in `user-place.js`) and typing growth. This change doesn't add it. I sorted the place- and landing-hold repairs since 2026-09-23 by the question each answered: - Which edge of the card stays still: #1429, #1536, #1552, #1574, #1587, #1771. #1552 and #1574 fixed how the hold was keyed across a second placement pass and across Send's admission, not which point the user works at. - Which item in a scroller stays still: #1045, #1464, #1480, #1549, #1694, #1715, #1735. - What waits behind a notice: #1473, #1493, #1725, #1738, #1742. - What a landing reveals on entering, sending or typing: #1303, #1364, #1571, #1602, #1624, #1626, #1645. - Whether the box or the page moves as the box grows: #1453 and this one. None of these commits names a case where `drafting` and `recentPlaceInput` disagreed, so a shared reading wouldn't have prevented them. The two readings also differ by design. `drafting` counts words left in the reply and a send still in flight, both of which outlast focus and the pointer. The place keeper deliberately follows whichever of pointer and focus came last. Their outputs differ in kind too: one is an edge of a floating surface, the other a node in a scroller's list. The typing scroll was a question of which thing moves, so it needed no working-point reading. One rule does repeat: a focused control counts as the user's place only while it is on screen. `holdBox` (`reply-landing.js`), the place keeper's "begins in the band" filter, and #1735's resize landing each state it. It is a candidate for a shared predicate, but not the primitive F described. ## Overlap with work in other worktrees `leaf.shift-a-thread-jitter` has uncommitted changes to `comment-placement.js`, `floating.js` and `floating-response.js`, based on #1705. Its `floating-response.js` hunk is small. Its `comment-placement.js` header rewrite overlaps the paragraph this change rewrites, so expect a textual conflict there. `leaf.thread-card-margin-avoidance` is mid-merge in `comment-placement.js` and `margin-projection.js`. Neither touches `makeRoom`'s call from `floating-response.js` or the frame tokens. > _This was written by Claude Code on behalf of max-sixty_ --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
The draft and sent message now use the same text measure in Threads, so sending a comment preserves its visual position. Send has its own row below the draft's scrolling text. When a new agent turn arrives or grows below the visible panel, the selected conversation follows it while that conversation is still the reader's place and its latest message is at the panel's reading edge. Scrolling into later cards, back through history, or receiving a reply in another thread keeps the reader's place.
Browser coverage checks the composer geometry with short and scrolling drafts, continued growth of a long reply, a short panel with earlier or later cards, a selected conversation before later cards, and preservation of the visible card while reading history or later cards. The placement primitive reports the card the reader explicitly named alongside its correction anchor, so a fallback anchor does not block an incoming reply.