Repository navigation
Give a floating box's motion one owner for place-then-read, and solve a resized box at its old size - #5242
Merged
Conversation
…led card at the window's foot
A placed box's motion now owns the order its readings and its placements take. The
margin card and the comment box each ran an observer of their own that asked for a
placement before the motion read a change of the box's size, and each read in that
placement's landing. They now hand box-motion their placement instead (`placement`:
what holds the box, and how to place it now). One observer in box-motion watches the
parts of every placed box: a change asks the box's placement first, and every landing
that stands the box reads it (`placed`). floating.js hands over what holds the box from
the placement itself (`held`), in place of the `heldEdges` export, and box-motion, not
each owner, forgets a box no placement stands. A card Send opens grows out of its field
from the next reading (`drawnAt`), whichever landing makes it.
The observer is made once, as box-motion loads, because the order observers deliver in
matters here. A landing in its delivery can resize the placed box, which the
placement's own observer also watches. Made when the comment box first opened, the
motion's observer came after the placement's, which had already read the old size and
reported the new one as a loop ("ResizeObserver loop completed with undelivered
notifications", in Chromium, on one of the property test's comment-box cases).
The card now reads at every landing, as the comment box already did, including the
placements each scroll frame asks for. A reading with nothing changed returns before it
writes; under an open card, 30 wheel steps cost about 1 ms more of style and layout
reads in Chromium.
The motion also learns which edge of its room the placement holds the box against
(`against`, from the plane the placement chose). A card beside its passage that a
scroll carried past the window's foot in the frame it shrank was drawn below that foot
for a frame, 146 px below in a 900 px window, and rose back to it: the scroll carried
its old reading down with its passage, and its placement's whole move travelled. A
resized placement's move is now the plane's as far as the placement would have moved
the box at its old size: as far as its passage moved past it, as before, and then back
inside the edge it is held against. Only the shrinking travels, and the card's outline
stands at the foot from the first frame.
`test_a_scroll_that_takes_a_shrinking_card_past_the_windows_foot_draws_it_there`
fails on the parent commit in Chromium and Firefox and passes here.
> _This was written by Claude Code on behalf of max-sixty_
…ves the foot A click on another thread's margin entry while a card was open stood the card beside the new thread at once, though the card is meant to travel there from where it stood. Two things stopped it. First, closing the old card removed its placement attribute, and the card's `held` was gated on that attribute, so the new thread's first landing found the box held by nothing and forgot where it stood. The card's `held` is now its placement driver's own, which holds until the closing card's fade ends and the driver stops. Second, a placement that kept the box's size counted as the plane's move, as a scroll's does, so two cards of the same size never travelled, on another passage or on the same one, even before `held` was gated on the attribute. The card now tells its motion when a landing stands it anew, the first landing of a thread it opens (`placed`, `anew`), and the motion then moves it from where it stood as its own move. Comparing the anchor the box stands by instead, as a first attempt did, read a revision that rewrote the passage as another thread, and missed two threads on one passage. A resized placement's share of the plane was measured from the move of the box's top-left corner away from where its layout stood it. That layout still held the box by its old edge. When the new placement held the box by another edge, the share therefore included the box's change of size. A card held at the window's foot that a scroll took back beside its passage as it grew was drawn with its foot already at rest and grew up to its head, with half its head row cut off for a frame. The share is now the move of the edges that hold the box now, measured from the old reading. The card stands its head by its passage and grows at its foot. Where a placement keeps the edges that hold the box, the two measures give the same move. The note on observer order keeps only what Chromium needs. Firefox delivers observers in the order they first observe, not the order they were made, and reported no ResizeObserver loop in the property test's two explicit examples in either order. `test_a_card_open_on_one_thread_travels_to_another_the_user_clicks` fails on the parent commit, where no motion starts. `test_a_card_a_scroll_moves_onto_or_off_the_windows_foot_as_it_resizes_only_resizes` replaces the test of the return to the foot and adds the move off it; it fails on the parent commit in Chromium and Firefox. Both pass here. > _This was written by Claude Code on behalf of max-sixty_
# Conflicts: # dist/kernel/kernel.json
… old size When a scroll and a change of a box's size land in one placement, box-motion splits the placement's move into the plane's part, which the box takes at once, and the box's own, which travels. It used to guess the plane's part from geometry: how far the passage moved past the box (`past`), capped and signed (`planeShare`), then pulled inside the edge the new placement held the box against (`against`). Each of the last three commits patched that guess for one case, and each case it fixed sat beside one it got wrong. Two such cases fail before this commit, in Chromium and Firefox: - A card the window's foot held for its height, carried down by a scroll up as it shrank to fit beside its passage, was drawn 50px below the foot for a frame. Main drew this one right; the previous commit's change to the share broke it. - A card beside its passage, carried down by a scroll up as it shrank, was drawn 34px below the foot for a frame, on main too. Neither its old placement nor its new one was held at the foot, so nothing told the guess where the foot was. The placement knows the answer. When a box's size changed since it last stood, floating.js now solves the same placement again at the old size, with Floating UI measuring the box at that size, and without the sizing middleware, which writes the box's size. That is where the box would have stood had it kept its size, with the surface's own shift, attachment limit and room, on both axes. `stand` returns how far the edges that would hold it then move, and box-motion carries its readings there. `planeShare`, `inside`, `past`, `beside` and its anchors, and the placement's `against` are gone. A box its owner keeps in the page's plane gets no such spot. The open comment box rides its words through scrolls without being placed again, so the placement that follows a change of its size catches up with every scroll since, and that is the box's own move. Its owner now passes the plane as "page" rather than as a function that always answers "page", and floating.js skips the second solve for it. Solved for it anyway, a two-line draft that a scroll had carried below the window jumped to the window's foot at Backspace and then travelled down. `test_a_card_a_scroll_moves_onto_or_off_the_windows_foot_as_it_resizes_only_resizes` gains both cases, and fails on the parent commit at the first. `test_every_part_of_a_floating_box_moves_one_way_per_input` covers the comment box. > _This was written by Claude Code on behalf of max-sixty_
# Conflicts: # dist/kernel/runtime/bundle-box-motion.js
# Conflicts: # dist/kernel/kernel.json # dist/kernel/runtime/bundle-annotation-overlay.js
floating.js now solves a resized box's placement a second time, at its old size, after the surface has read its answer. That solve runs comment-placement's middleware again, which rewrites `shown`, so "the last one read is the room the answer stood in" held only until the second solve. The note now says it holds when the surface reads its answer. > _This was written by Claude Code on behalf of max-sixty_
Comments name four changes we could consider later: one observer asking a placed box's placement for a change of its size instead of two ordered by creation; placing the open comment box again on every scroll, which drops the "page" exception; carrying the placement's room and hold in its answer, so the old-size solve can run in any order; and one home for the edges and old size the placement and box-motion each keep. > _This was written by Claude Code on behalf of max-sixty_
leaf-agent
approved these changes
Nov 3, 2026
max-sixty
added a commit
that referenced
this pull request
Nov 4, 2026
…heir owners #5244 and #5242 have landed, so three questions they held open now have one owner that every caller asks. A drawn thread's id. Seven readers spelled `data-lf-thread` themselves beside `drawnThreadId` in thread/selectors.js: thread/held-news.js, thread/reply-continuity.js, thread/surfaces.js twice, annotation-overlay/thread-preview.js, and annotation-overlay/margin-projection.js twice. Those that read one element's id now call `drawnThreadId`. Those that looked up the page threads drawn with an id call the new `drawnThreadsWithId` beside it, which queries `.lf-page-thread` by the escaped id as they did. The floating panel's `.lf-fp-asked` outlets keep their own `data-lf-thread`: it holds a thread's key on an outlet, not the id of a drawn thread. A page of parts' views. content-layout.js found the parts container itself: `body > main`, the `--lf-layout-box` test and the `[data-lf-views="parts"]` selector, all of which passages.js's `layoutBox` already reads. passages.js now exports `layoutParts` beside `layoutBox`, both read one selector constant, and content-layout.js's title marking calls it. Whether the user can scroll a box. box-motion.js tested `auto|scroll` against either axis and against overflowY, and scroll-containers.js tested it against overflowY. Each now asks geometry.js's `userScrollport`, which answers the same for every overflow value. Neither module crosses a boundary by importing geometry.js: dependency-cruiser finds no cycle and no closure rule against it. browser/AGENTS.md's question index names `drawnThreadsWithId` and `layoutParts` in their rows. No behaviour changes, so no test changed.
max-sixty
added a commit
that referenced
this pull request
Nov 23, 2026
… momentum (#6892) The comment box beside a tall focused element now follows a scroll on every frame, a trackpad's momentum included. It waits at the window's top while the element scrolls past, goes in the frame focus leaves sight, and comes back in the frame the element does. Before, the resting box rode the element's top off the window, and on the way back it stayed hidden until the scroll stopped, for about 2.7 s with the element in view in Firefox. Nobody chose the wait. #1705 put the open box on CSS anchors, so no scroll solved it again. #5242 left the page plane that way with a TODO, and #5428 made the resting box ride the same way. After that, only the scroll-end repaint that #5192 added in `user-place.js` moved it. `focusPlace` has since read where glides land, so that repaint protected nothing. - `floating.js` solves a box again on each scroll around the element it watches. A solve beside the words writes nothing, and a box held in by the window's edge stands fixed. Each surface's `autoUpdate` takes `ancestorScroll: false`, so each scroll solves the box once. - `geometry.js` `whenChanges` reports each frame `focusPlace` flips, replacing the scroll-end repaint. `whenNone` now wraps it. - The open or resting box writes its width only up to the card's measure. A sideways scroll under it no longer rewrites `--lf-float-w` on every step. **Behavior changes to weigh.** Where `c` goes now updates during a scroll. The resting box goes as focus leaves sight, though its placement could keep it on screen a little longer. On a page where On Me lists anything, the panel's row shows Next On Me instead of `c`, so after the box goes nothing shows where `c` goes. `field-readings.js` records that choice. **Evidence** (Firefox, the `css-theme-structure` page, 1440×900): the resting box showed on exactly the frames where focus was in sight, 1013 of 1013; on the base, 360 frames owed a box and showed none. The open box held on 1030 of 1030 frames, keeping its typed words and focus. In Chromium, script time over a 160-frame smooth scroll was 11.5 ms against 11.3 ms on the parent commit. Max asked for this in a comment on a Leaf page, and a fresh-context agent reviewed it over three rounds. `test_the_box_beside_a_tall_target_waits_at_the_window_s_top_through_a_scroll` fails on the base in Chromium and Firefox, and `floating-placement.test.mjs` covers the scroll listeners. > _This was written by Claude Code on behalf of max-sixty_
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 floating box's motion now owns the rule that it reads a change of the box's size only after the placement that change asks for has stood the box. The margin card and the comment box each carried their own copy of that rule. With the rule in one place, the placement can also tell the motion where it would have stood a resized box at its old size, which fixes the frames where a card resizing under a scroll was drawn past the window's foot.
What changes
One owner for "place, then read".
boxMotiontakes the box'splacement(held(): what holds the box;place(): place it now) instead of an observer andheld. One observer in box-motion watches the parts of every placed box: a change asks the box's placement first, and every landing that stands the box reads it (placed). The card's and the comment box's observers,followCard,readFaband floating.js'sheldEdgesexport are gone. box-motion forgets a box no placement stands, which each owner used to do.Why one observer, made as the module loads. A landing in its delivery can resize the placed box, which the placement's own observer also watches. Chromium delivers observers in the order they were made. An observer made later than the placement's, as the one made when the comment box first opened was, let the placement's observer read the old size first, and Chromium reported the new one as a ResizeObserver loop error. Firefox orders observers by their first
observeand reported no loop in either order.The card reads at every landing, as the comment box already did, including the placements each scroll frame asks for. A reading with nothing changed returns before it writes; over 30 wheel steps under an open card it adds about 1 ms of style and layout reads in Chromium.
A resized box starts its motion where its placement would have stood it at its old size. When a box changed size since it last stood, floating.js solves the same placement again at the old size (Floating UI measuring the box at that size through its platform override, without the sizing middleware), and box-motion takes the move to that spot as the plane's and the rest as the box's own. This replaces a guess from geometry (
planeShare,beside,past, the placement'sagainst) that the last few changes kept patching. In a 900 px window it fixes four cases where a scroll and a change of size land in one frame:The open comment box rides its words through scrolls without being placed again, so its owner passes its plane as "page" and gets no second solve: its next placement's catch-up travels as its own move.
A card travels to the thread the user opens next. The card tells its motion when a landing is the first of a thread it opens (
placed(place, anew)), and the motion moves it from where it stood as its own move. Before, a placement that kept the box's size was read as the plane's move, as a scroll's is, so a click on another thread's margin entry stood a card of the same size beside the new thread at once. A closing card also keeps the edges its placement held it by until its fade ends, so the next thread's card has somewhere to travel from. Atwalk to a thread off the window now runs a card of the same size off the window and back in with the page's glide, asmainalready did for cards of different sizes: the card's travel and the glide run on separate clocks.drawnAtnow marks where the next reading draws the box from, so a card Send opens grows out of its field whichever landing reads it first.Left for later
Comments mark four bigger changes that could simplify this further: one observer asking a placed box's placement for a change of its size, instead of box-motion's and Floating UI's ordered by creation (box-motion.js); placing the open comment box again on every scroll, which drops the "page" exception (floating-response.js); carrying the placement's room and hold in its answer, so the old-size solve can run in any order (comment-placement.js); and one home for the edges and old size floating.js and box-motion each keep (floating.js).
Tests
test_a_card_a_scroll_moves_onto_or_off_the_windows_foot_as_it_resizes_only_resizes(Chromium and Firefox) makes all four moves on one page. It fails onmain.test_a_card_open_on_one_thread_travels_to_another_the_user_clicksfails onmain, where the card stands beside the second thread with no motion.main, the focused card, comment box, aim and pane tests and the property testtest_every_part_of_a_floating_box_moves_one_way_per_inputpass in both engines, andpnpm run test:runtimepasses.