Skip to content

Read where Leaf's glides leave a node from the browser, rather than a model of sticky layout - #6810

Merged
max-sixty merged 51 commits into
mainfrom
carry-one-measure
Nov 23, 2026
Merged

max-sixty merged 51 commits into
mainfrom
carry-one-measure

Conversation

@max-sixty

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

Copy link
Copy Markdown
Owner

Leaf predicts where its glides (the smooth scrolls it drives itself) will leave a node, so that a key pressed during a glide acts where the glide lands. Six places made that prediction with arithmetic that went wrong beside sticky boxes. For example, on a sidebar page whose track holds the only ask, m pressed while d glides left the page at 50 on main, where the same keys typed slowly end at 362. The track rides the page only 40px before it sticks, and Leaf counted it as riding the whole glide. All six places now get the answer from the browser. whereGlidesLand (scrolling.js) has readScrolled (arrivals.js) set each gliding box to its goal, read the node, and set every box back, all in one task. The browser lays out sticky boxes, their holders' ends, transforms and nested scrollers as the write lands, so the read is exact in Chromium and Firefox alike. travelFrom and the glide readings built on it, readingBandMoves, alreadyArrived, makeRoom and the New reply rise all read through it. landingBand's cap and roomTravel read carried, which measures how far a scroll carries a box before its sticky line stops it, without writing anything.

To weigh:

  • readScrolled writes only to boxes a Leaf glide is already moving, so it stops no scroll that someone else started. Each read leaves one extra scroll and one extra scrollend event; they arrive with the glide's own frames, and the glide's hold on the scroll sequence keeps them from ending anything. Codex checked paths from scroll handlers and IntersectionObservers in both engines.
  • A landing never scrolls a region past the point where the destination stops moving with it.
  • Three cases are still read wrong. A sticky box resting on its line in its own place reads as stuck, because only Chromium can say where its own place is. An author's sticky pane taller than the window keeps an ask at its foot out of reach, as it does on main. The comment box picks its side from where the page stands now.
  • The change adds about 110 lines of runtime code net.

Part of #6481. This covers the glides Leaf drives. Scrolls that the browser or a script starts, and box-motion's carry, still have no single owner: followsEnd, scrollStarts, landGlides, scrollDrawn, CARRY and seenRect's rest flag each handle part of it.

Max asked for this on his session's decision page. Codex reviewed it three times and a Claude reviewer twice; their findings are fixed or listed above.

Tests: four new browser tests (two m walks beside a sticky track, a node that two glides bring into view, and a card anchored to the page that keeps its clip during a glide). 207 walk, glide, landing and card tests pass in both engines, including the 128 key-during-glide journey cases, along with pnpm run test:runtime and check:browser.

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

…indow

The page kept a 72px band, `--lf-foot-room`, across the window's whole width at
the end of every scroller and below every box sized to the window, for a panel
row 540px wide in the window's middle. Each place that kept it needed its own
rule (the body, a page of parts' open part, every workspace region and footer
through `--lf-end-room`, tab panels and side lists, the file editor, sticky
tracks and the contents map through `--lf-view-height`, the trace stage, a
landing trim), and it kept needing patches where the band stood away from the
panel: #3394, #3619, #5969, #6057, #6555, and #6671's runtime reading of where
the panel stands.

Now the panel stands over the page, as every other control of Leaf's does, and
the user folds it to its leaf (`.`) where it covers what they read. Only Leaf's
own placement counts the panel's box. A landing keeps clear of it only where it
stands across the destination's columns (`landingBand`, with `shownWindow` read
the same way in `roomAround`): the root's band ends at the foot band the panel
states, and a scroller the page can't carry, in a workspace that fills the
window or stuck in it, ends there too, which replaces the band each pane kept in
its padding. The panel no longer writes the root's `scroll-padding-bottom`: a
band across the whole window held the browser's reveals above it, so a Tab onto
the last link of a sidebar's stuck list, which now reaches beside the panel,
scrolled the page 340px. Read receipts, thread cards and key badges still read
the panel through `declareCover`. A block sample's frame keeps the row's room
below the sample, since the frame is its window and is sized from its body.
A Layout's end padding now adds the window's safe area at its foot, so a
phone's home indicator doesn't hold a page's last line under the row.

Behavior that changes:
- Column and sidebar pages end with their own 96px (72px on a phone), which
  already clears the row; they scroll 72px less.
- A held workspace's frame reaches the window's foot less an 8px gap matching
  its head, and the row stands over whatever it crosses there, a footer
  included. A flowing workspace ends as a document does.
- The last 44px of a scroller that ends flush with the window's foot, where the
  row crosses it, shows only once the panel is folded. Of the 27 examples, 4 end
  with words under the row at 1728x999 and 1 on a phone; on main, 1 did.
- Keyboard focus on a control there counts as out of sight, so the next key lets
  go of it; Tab moves on once the panel is folded.
- A link to a held workspace region, or a file opened in an editor filling one,
  scrolls the page to the region's start where something after `main` gives the
  page room to scroll; no real page writes after a workspace's `main`.
- The browser's own reveals, such as find in page or a caret in a page's field,
  no longer stop above the panel.
- A held root workspace keeps an 8px gap at its foot, matching its head.
- The render gate's `under-panel` refusal is gone, with the scroll-to-end
  reading it alone used.

Tests: the assertions that a scroller's end clears the row, or that a region
reserves the band, go, with the tests of a link to a held region and of a file
opened in a held editor; tests that read the band from the root's
`scroll-padding-bottom` read it from `landingInsets`; a short
playground's actions are reached with the panel folded; the document keeps no
room on screen as on paper; the panel's band at the foot is still the row's
height and gaps.
# Conflicts:
#	browser/layouts.css
#	tests/journeys/test_render_widgets.py
The tests page and wheel a margin thread past its edges onto the page, so
the page must be able to scroll both ways. They reached the paragraph with
Playwright's reveal, which the root's `scroll-padding-bottom` held above
the panel's band, so the reveal scrolled the page down and left room above.
The page now keeps no band and the paragraph showed where it stood, so the
page sat at its top and `u` and the wheel up had nowhere to go. The tests
now scroll the paragraph to the window's middle themselves; what the thread
does at its edges is unchanged.
The test clamps a long preview name in a 180px window and expects the
clamp to go once the window grows to 800px. That holds only where the
preview stands below its target, where the grown window adds room; a
preview above it keeps its place and its room while the room holds a line
(`fit`, preview.js). The browser's Tab reveal, held above the panel's band
by the root's `scroll-padding-bottom`, used to scroll Aim up the short
window, so the preview stood below it. With no band the reveal moves
nothing, the preview stood above Aim, and its clamp stayed. The test now
scrolls the buttons to the window's top itself, on a page long enough to
do so; how a preview clamps and unclamps is unchanged.
The test scrolls the last words of a long paragraph to a third of the
way down the window and hit-tests the row's marker there. The paragraph
ended the page, so on a 390x844 phone the scroll stopped at the page's
end with the words at 748px and the marker under the floating panel's
row, which took the hit. The page's end padding used to include the
panel's band, which let the words scroll clear of the row; the page now
keeps no room for the panel. The page now goes on past the passage, so
the scroll reaches its aim; how a row follows the page's scroll is
unchanged.
The test comments into a screenshot and has the answer grow the card
beside it past the window's foot, where it rises. It reached the shot with
Playwright's reveal, which the root's `scroll-padding-bottom` held above
the panel's band: the shot's foot at 816px of 900, the card opening at
508px and rising 81px for the answer. With no band the reveal left the
shot's foot at the window's foot, the card opened at 592px and rose 165px,
and in one frame of that rise the shift watch saw the card's empty reply
box move 67px without input. The test now scrolls the shot's foot to the
root's landing band (`landingInsets`), where Leaf's own landing brings it
and where the old reveal did, so it measures the same growth as before.

The shift at the lower position is not this branch's: main's runtime
shows the same 67px move with the shot scrolled there (scrollY 231).
…ght, so it stops jumping between seats

With no room kept for the floating panel, a visual review that fills the
window ends its case at the window's foot, under the panel's row. Pressing
c or Add feedback there seated the comment box in the case's discussion:
the empty discussion was display: none, so seatFab judged the whole case,
which the user mostly sees. Seated, the discussion laid out under the row,
the next judgment of the outlet's own box refused it and sent the box home,
the emptied discussion vanished, and the case took the box back. The box
moved between the two about every 70 ms, the page's rendering never
settled, and the comment field left the case under the user's typing.

An empty discussion now lays out with no height, hidden, so its outlet is
judged where the box will stand, and a boxless outlet is judged by the same
rule as one with a box: refused wherever a cover crosses it. This drops
#5669's lenient reading of a boxless outlet, whose only user was this
discussion; the phone case it fixed now passes on the outlet's own box,
which stands below the window there.

Behaviour that changes: in a review that fills the window, the comment box
stands beside the case, over its head, rather than in its discussion. Where
the review flows with the page, as on a phone or in a window narrower than
the review's 58rem, the box still opens in the case's discussion.

Tests: the keyboard-locality and On Me tests find the box on the page
rather than in the case. The reorder, case-goes and phone-resize tests run
in a 700x768 window, where the review flows, so they still hold a box
seated in its case.
The archetype test scrolled its control into view if needed and then held
its neighbours' positions. The playground's Send stood in view at the
window's foot (y 834-866), under the floating panel's row (842-886), which
the page no longer keeps room for. Playwright's click found the row over
it and scrolled the page 395 px to reach it, and the test read that scroll
as the press moving Reset and the menu.

The control now stands in the window's middle before the baseline is
read, as a user scrolls a control into sight before pressing it, so the
test again measures only what the press itself moves. No product
behaviour changes.
…in it

The live-samples test scrolled the second sample's foot to the window's
foot with the browser's scrollIntoView, then clicked the field of the
sample's own panel, which stands at that foot. The host's root no longer
pads its scroll by the floating panel's band, so the sample's panel now
lands under the host's panel row, which took the click.

The test now lands the sample with Leaf's own scrollIntoView, whose band
ends above the host's panel, so the child's field stands where the user
can press it. No product behaviour changes: a reader scrolling by hand
brings the sample's foot clear of the row the same way.
The comparison fixture ends its held workspace with a footer holding the
settled decision, which now reaches the window's foot under the floating
panel's row: the accepted cost of keeping no room for the panel. The
sweep clicked the row's middle, which the panel covers, and Playwright
waited on it until the test timed out.

The sweep now presses the row's words at its start, which the panel leaves
clear, as a user would. No product behaviour changes.
The aim sweeps press a control only inside the view of each scroller
that holds it, less what stands over an edge the scroller can still
scroll toward. For the page's foot they read the root's
`scroll-padding-bottom`, which held the floating panel's band. The page
no longer writes that padding; it states the band for Leaf's landings
in `landingInsets` (geometry.js). So the corpus's phone sweep pressed
the alert-ask pin on corpus-alert-thresholds where the panel's row
stood over it at the window's foot, on a page with 5616px still to
scroll, and counted it 0x0 under the row's Comment press. The sweeps now
read the root's foot from `landingInsets`, so a control the user can
scroll clear of the panel is judged where they would press it, and one
the page can't carry past the panel is still pressed where it stands.
Walking a side list longer than the window with the arrows scrolled the open
item's start out of the window from the eleventh tab on, and the list's own row
moved by a pixel or not at all. The list now reaches the window's foot beside
the floating panel, so its landing band asks for a tab the root's band leaves
under the panel's foot band. The landing counted on the page to carry the list
the rest of the way, but a sticky list a pixel short of the line it sticks at
rides the page for that pixel alone: the page scrolled 16px, the list stuck,
and the item went with the page. At the list's end, where the list can scroll
no further, and with the panel folded, where the list's band isn't clipped
while the root's still is, the page scrolled the item 37px and more away for
nothing.

`pageCarry` (geometry.js) now reads how far scrolling the page on can carry a
scroller up: to the page's end, and only until a sticky box around it sticks;
nothing for one stuck or fixed in the window. A scroller's landing band ends
that far below the root's foot where the panel stands across the destination,
replacing the yes-or-no reading (`stuckBox`, or a page that doesn't scroll),
and the root's move for a destination in an inner region goes no further than
the page carries that region (landing-scroll.js, `readingBandMoves`).

The test walks the list with the panel open as far as its rows land clear of
the panel, then folds it with `.` for the last two rows: the list ends at the
window's foot, where the panel covers them and focus there counts as out of
sight, the cost the branch accepted.
…above the panel

At 800x720 the film's pane scrolled to its end put the stage's foot at 701px,
under the floating panel's row at 662: the pane now reaches the window's foot
less the workspace's 8px gap, where it kept the panel's 72px band before. The
row covering the pane's last 44px until the user folds it is the cost the
branch accepted. The test still holds what the user relies on, the fix it was
written for: the stage keeps its content's height, and the pane scrolled to its
end shows the terminal whole in the window.
…, as 600 did

The workspace's regions now reach the window's foot less its 8px gap rather than
stopping the floating panel's band short of it, so the playground's controls
region is 66px taller at 1100x600: its list of controls fits there (415 of 415px)
where it ran 53px past the region before. The test is about a region too short
for its controls showing that more is below, so it opens the page at 530px,
where the list runs about as far past the region as it did at 600.
The trace stage now reaches the window's foot rather than keeping the floating
panel's 72px band under it, so at 1440x900 the capture fits its canvas by width
(958 of 960px) and the test's premise, a fitted capture narrower than its
canvas, failed before playback began. At 1440x828 the stage is the 804px it was
at 900, and the capture 851px of 960, so the test again checks a played frame
over a capture that centering rules could reach.
The test stands in for find-in-page opening the closed tree onto its match and
asserted the row ended inside the root's landing band, which stops above the
floating panel. The browser's own reveals no longer stop there (the root keeps
no `scroll-padding-bottom` for the panel, as the branch decided), so the row
stood at 377-432px under a band ending at 416 and the test failed with nothing
moved. What the test protects is that the shift the opening announces a frame
later doesn't return the tree to where the reader left it, so it now reads the
row in the task that reveals it and asserts that, once every scroller is still,
the row stands where the browser put it.
On a 480x520 phone, Playwright's reveal of the image tools now stops with them
at the window's foot rather than above the floating panel's band (the root
keeps no `scroll-padding-bottom` for the panel, as the branch decided). Chromium
scrolls by whole pixels, so the tools stood at 466.1-520.3px and showed 99.4% in
the viewport where the test asked for all of it. The test is about a short
window keeping a usable capture while the document scrolls to the rest, so the
reader now scrolls the tools to the window's middle, as a person scrolling to
them would, and they show whole there.
A press on a file tree row standing with its last pixel under the floating
panel opened nothing. Focus arrives on the press's mousedown, and the tree
revealed every row focus reached, so the root's landing band, which ends above
the panel, scrolled the page 37px before the mouseup. The mouseup fell on the
row below, the click went to the tree around both, and neither file opened, so
a navigator under a worktree list left its worktree closed.

The tree now leaves a row the user pressed where they aimed it, as a pressed
control stays put elsewhere (off-flow.js skips a press the same way), and
reveals only a row the keyboard or a placement reaches. On main the same press
lost its click for a pointer; the tests passed there only because Playwright's
own reveal before its click honoured the root's `scroll-padding-bottom`, which
lifted the row clear first.
… scroller

`pageCarry` counted every box `stuckBox` names as one the page can't carry, so
a landing left a destination where the page would have carried it clear: in a
region sticking at its foot and standing in its own place (`stuckBox` counts a
box on its foot line as stuck), the last row stayed at 473-493px under the
panel's band where the page used to scroll 77px to land it at 396-416; and in a
region stuck at its top inside a holder that clips, the page didn't move at
all, though its scroll carries the holder and all it holds.

The page's carry is now limited only by what its own scroll can't move: a box
fixed in the window, and a box sticking at its top in the page, for the
distance it still travels before it sticks. A box its holder's end pushes past
its line rides the page with the holder. The page's remaining travel is read
from `scrollLimit` (scrolling.js), which owns it.

Both cases land where they did before 8b40689b30, in Chromium; the side list's
walk keeps its item in view as that commit made it.
# Conflicts:
#	tests/browser/test_render_files.py
#	tests/browser/widgets/test_tabs.py
#	tests/journeys/widgets/test_workspaces_and_bounds.py
…he head

In the floating panel's thread view, each message's controls hang 12px past
their head's end into the room the transcript keeps there, so react and copy end
under the head's close (#6672). The head cuts what it holds 8px past its end, so
it cut the last 4px of each control: the focus ring lost its right side, and a
press on that strip landed on the transcript instead of the control (at
1440x900 under a finger, Edit and Add reaction span 940-984px and presses at 981
and 983 reached the transcript). The panel now states the hang once, as
`--lf-msg-controls-hang`; the room's end margin and the head's cut both read it,
so the cut stands a gap past wherever the controls end. Heads with no hang keep
their cut 8px past their end, as before.

The aim sweep in test_every_control_the_layer_offers_is_a_box_the_user_can_hit
found this as "lf-icon-action at 0x0 under .lf-thread-transcript", on main under
a fine pointer and, once the page stopped keeping room for the panel, under a
finger too.
The sweeps judge a press only inside the view of each scroller that holds a
control, less the band a scroller keeps clear at an edge it can still scroll
toward. They walked every ancestor up to the root, so a control in the fixed
panel was held to the root's foot band whenever the page could scroll, though
scrolling the page never moves it. On main the aims page overflowed the window
by 10px (the body's foot room), the panel's band at the foot covered every
control in an open view, and the sweep never pressed them. With the foot room
gone the page fits, the root stops narrowing the view, and the sweep pressed
them for the first time. The walk now stops at a box fixed in the window, so the
panel's controls are pressed where they stand on any page.

Pressing them also found the sweep misjudging an open popover. A press on the
top 2px of the panel's leaf, with a message's reaction list open over it, landed
on the list, which stands in the top layer; the sweep read the layer of the
nearest pressable ancestor, the message, found it in the leaf's layer, and
counted the leaf as covered by another control. A press that lands on a surface
of another layer is now that surface's, as the sweep's rule for popovers says.
…here

When an answer arrives in a thread open in the panel, the view grows upward from
the panel's foot, and box-motion.js carries the messages from where they stood
on screen to their new places over 300ms. The test read the first message's
offset from the view's top in whatever frame `rendered` returned on, so it
measured the carry rather than the place: a frame-by-frame trace of the tall
case gives 591px at the motion's start, 85 at 100ms, 44.6 at 133ms and 14 from
300ms, identically on this branch and on its merge base. The branch's 85 (CI
macOS and locally) and main's local 44.66 are two frames of that one motion,
and main's CI passed by reading after it ended. The test now waits for the
panel's motion to end before reading, and still fails when the view scrolls on
an arrival (scrollTop 40 reads an offset of -26).
…r the click

The test stands in for find-in-page with a script that opens the closed tree
and scrolls its last row into view. The script is no input, so the shift watch
judges what the opening moves as moving by itself once the reader's last input,
the click that takes focus off the summary, has finished rendering. With the
tree in view, the opening carries the trace's readout, action and phase lines
164px down. On an idle machine the script lands before the frame that reads the
click's rendering settled, so the click owned that move; on CI's runners it
lands after, and the watch reported it on Linux and macOS in every branch run.
A 50 ms pause before the script reproduces the report locally. On main the
click's actionability scroll, which stopped above the panel's band, had left
the tree above the window, so the opening moved nothing in view.

The reader now clicks the page's heading, which leaves the closed tree below
the window, where a find's match often stands, and the test waits for the
click's rendering to end. So the opening is judged on every host, moves nothing
the reader sees, and the reveal scrolls the page as well as the tree. What the
test protects is unchanged: with the runtime's mark of a find's travel disabled
(scrolling.js, `opened`), continuity returns the tree to the reader's old place
and the test fails.
…r with Enter

The test opens the second image of a pair with Tab and Enter, and checks that
closing the viewer leaves the comparison where it stood. A Tab's arrival now
moves the page twice: the browser's reveal, in the key's task, stops at the
window's foot, and the runtime lands the arrival clear of the floating panel in
the next frame's callbacks (landing-scroll.js, `onCurrentLocation`), 85px
further here, so both moves precede the next paint. The test read the shot's
place as soon as focus arrived, so on a starved runner it could read the place
between the two moves and then compare it with the landed place after Escape;
the branch's macOS job failed that way. On main the browser's reveal already
stopped above the panel's band, so the landing moved nothing and the read was
the same in every order. A starved local run with a pause before Enter fails
the same way on the branch and passes on main.

The test now waits for the Tab's rendering before it reads the shot's place, so
it compares the place the reader saw when they opened the viewer on every host.
…ew helper

`tab_onto` focuses its target by script, then presses Shift+Tab and Tab.
The root no longer pads its scroll by the floating panel's band, so a
script's focus leaves a target the window already holds where it stands,
and that can be under the panel's row. In the preview test that failed
on CI (test_a_preview_says_nothing_its_target_shows_whole), the previous
step's Tab landing had not finished when the next target took focus: at
scrollY 1154 rather than 1191, `#rate` stood at 863-879px under the row's
cover (842-886px), `focusPlace()` read null, and Shift+Tab let go of it to
the reading place, so the helper's Tab went on to `#speed`. Which slider
failed (`#rate`, `#volume`, `#pace`) varied with that landing's timing, and
8 of 17 local runs failed. On main the root's `scroll-padding-bottom`
made the same focus scroll the target to the window's middle.

The helper now lands the target with Leaf's own `scrollIntoView`
(block nearest, instant) after focusing it, as a Tab's arrival does, so
the steps start where the user sees the control. The landing moves
nothing where the target is already seen, so the other callers' pages
stand as before. No product behaviour changes: a user stepping with Tab
gets the same landing from the runtime.
…out of the window

In the visual-review journey test the user writes a comment on a case at
a phone's width, then widens the window to 1366x768, and the comment
field ended below the window's foot with their draft in it. At 390px the
case's discussion stands at the document's end under the panel's row,
so `seatFab` refused it (725-753px against the row's cover) and the box
floated beside the case. On the resize the thread surfaces offered the
discussion again, now wholly below the window (1054-1082px at scrollY
0, window 768px). `covered` reads a box below the window as under no
cover, so the editor moved in. The move itself scrolled the page to it
(scrollY 0 to 449, no script scroll logged), and the resize's restore
of the reader's place (version.js, `restoreShifted`) then scrolled back
to the place read while the box floated (scrollY 109), leaving the field
at 981-1013px. With 28493ab's runtime change reverted on this
branch, the box stays in its discussion through the resize and the test
passes.

A seat out of the window takes the editor only as it opens, since only
the opening's landing (`landFabFocus`) brings the seat in. Now an
editor the user sees, outside an opening, stays where it is rather than
move to a seat the window doesn't reach, so after the resize the box
stays beside the case's head with the draft in view. An opening still
seats the editor below the window and lands it, as a diff file's comment
below a long hunk does.

`outOfWindow` (geometry.js) answers whether a box stands wholly above or
below the visible viewport, a box with no height included, which
`seenRect` asked inline and an empty outlet's seat now asks too.
Main's #6745 fixes the panel thread's clipped Copy button by moving the
negative end margin from the control room to the panel's message head, so
the head's cut moves out with it. The branch had fixed the same defect with
an `--lf-msg-controls-hang` variable read in three sheets; the merge keeps
main's one-rule fix and drops the branch's.
… reached under the panel

A Tab's arrival lands at the next render, which on this branch is what lifts a
control Tab reached above the floating panel: the root no longer keeps a
`scroll-padding-bottom`, so the browser's own reveal leaves a control that shows
whole in the window where it stands, under the row. Until that frame, focus there
counts as out of sight (user-place.js, `focusPlace`), so a key pressed first let go
of it. On pr-walkthrough's CallDiff tab, Tab then Enter on `src/summary.rs:259`
dropped focus to the body and opened nothing, whenever the frame came after the
Enter; on main the browser's reveal had already cleared the panel's band.

Now a key that comes before that frame lands the arrival first, at the input edge,
so every reader of the key finds the page as the same keys typed slowly leave it.
A pointer press still doesn't, since it aims where things are drawn.

Evidence, with every animation frame delayed 150ms (a scratch copy of
`test_focus_reactions_keep_a_projected_data_target[patch]`): unfixed branch 7 of 12
passed, each failure with the link at y 849-869 under the row at 842-886 and focus
let go to the body; main 6 of 6; this change 8 of 8, the link landing at 807-827
every time. CI macOS failed the test in 2 of 3 branch runs.
… stale keys

The stale-keys sweep on thread-panel-gallery pressed a window sample's Reset at
(22, 886), whose frame then stood just below the window, and read Reset as
unavailable before the sample's new page arrived. The page's readiness counts
what a sample's page draws only while its frame shows (sample.js): a chart in a
frame out of view waits for a rendering it never gets, and counting it would keep
the page arriving until the reader scrolls. Now that the page keeps no band at
its foot, the sweep's presses reach that Reset, so the reading shows each frame
still arriving, as a check does (`start_near_work`), and puts the scroll back.

On main, a Reset pressed at the window's foot on thread-panel-gallery read
unavailable at readiness 6 times in 6, with the frame marked `data-lf-unseen`;
read through `start_near_work`, available 6 in 6. The first reading on a page now
starts and shows every sample there, about 5 s once on feature-gallery.
…m sweeps

The corpus gate's phone sweep failed in three of the branch's six CI jobs
with a margin marker read as 0x0 "under .lf-icon-action" (the panel's
leaf) or "under .lf-compose-press-word" (the row's press). The marker
stood in a margin carrier, the fixed box margin-layout.js anchors to the
page so that the page's scroll carries the row, and the carrier stood in
the window's foot band under the panel's row while the page could still
scroll. A user scrolls the page and the marker comes out from under the
row, so the marker is reachable and the sweep was wrong.

The sweep's walk stopped at every fixed box, so that the panel's own
controls are pressed where they stand. That stopped it at the carrier too,
short of the root, whose foot band (`landingInsets`) keeps the sweep from
pressing in that band while the page can still scroll toward it. Main
walked past every fixed box to the root, which held the panel's own
controls to the band as well.

The walk now ends at the first fixed box with the scrollers the runtime
says carry that box (`carriersOf`, scroll-containers.js, now on the check
API): none for the panel, and those carrying its anchor for a box Leaf
anchors, which for a margin carrier is the root.

Which run fails depends on where the tab openings leave the page's scroll
when each tab is read. On the corpus at 390x844 under touch, a carried
marker placed under the leaf with 2,323px left to scroll gave the exact
finding every time with the previous sweep, and nothing with this one;
carriersOf reads [] for the panel and [root] for the carrier.
…it left the editor

`test_picking_a_file_under_an_open_panel_brings_it_clear` failed once in
the branch's CI (macOS, `(848, 674)`) and fails the same way on main. The
editor shows the picked file while travel is still resolving it; the
landing that scrolls the page starts frames later, after travel stops any
browser scroll and the editor's disclosures are ready (anchor-travel.js,
`arrive`). The test waited on the file's name and then on
`scroll_settled`, which reads three still frames as settled and can't
tell a scroll not yet started from one that ended, so on a slow machine
it read the editor before the glide began or partway through it.

In every failing copy the glide still ended with the editor's foot at
648px, clear of the panel's card at 674px, so the behaviour the test
protects held; only the reading was early. The test now also waits for
the address to name the file, which travel writes in the same step that
starts the scroll, before waiting for the scroll to settle.

Under `leaf-dev suite flake` (background priority, 2 workers) the test
failed 1 of 10 copies on this branch and 2 of 12 on main before, and
passes 16 of 16 after.
…ot by hover

test_trace_comments_restore_an_exact_image_and_duplicate_named_element put
the pointer on `.lf-trace-body` with `hover()` before its wheel. Playwright's
hover first scrolls the element by Chromium's reveal rule. Since the root
stopped keeping `scroll-padding-bottom` (#6688), that rule scrolls the page up
9px after the Escape landing; with only that padding restored it scrolls
nothing. A margin pass in the same task rewrote the carrier of the trace
tree's margin row to the same place in window coordinates. Chromium applies an
anchored box's scroll compensation after animation callbacks, so the next
`requestAnimationFrame` read found the anchor moved and the row not yet, and the
shift watch read the row's catch-up a frame later as a 9px move without input.
It failed 2 of 2 instrumented copies and 1 of 4 plain ones at
`--cpu-throttle 4`.

The test now moves the mouse to the middle of the body's shown part, which
scrolls nothing, as a user's pointer does; the journey is otherwise unchanged.
8 of 8 copies pass at `--cpu-throttle 4`.

The watch misreads the same way on main wherever a scroll no input makes is
followed by a margin pass while a carried row shows; this change doesn't
address that.
# Conflicts:
#	tests/browser/test_render_files.py
# Conflicts:
#	browser/runtime/composing/surface.js
#	tests/browser/test_render_send_placement.py
…sure

Three places answered how far a scroll of one box carries a node, and two
got it wrong beside a sticky box that hadn't stuck yet. `readingBandMoves`
(landing-scroll.js) counted a glide under way as carrying the destination
its whole length, and capped the page's next move by `pageCarry` read from
where the page stood rather than where the glide would leave it.
`travelFrom` (scroll-containers.js, behind `glideTravel`, `heldTravel`,
`glideGap`, `seenGlided`, `seenLanded` and `seenAhead`) counted a carrier's
whole glide unless `stuckBox` said the node had already stuck. With a pane
standing at top 50 that sticks at 12, a page glide from 0 to 100 carries
the pane 38px: `landedBox` put a destination now at 218 at 118, where the
centre landing left it at 180, and `glideTravel` read -100, in Chromium and
Firefox alike.

`carried(node, box, by)` in geometry.js now answers it for every caller:
the whole scroll for what the box scrolls as content, clamped to how far
the box can scroll; none under a box fixed in the window; and for each
sticky box that sticks in `box`, the distance the scroll carries it before
it reaches its line, the least of them. A box its holder's end has pushed
past its line rides with the holder. `pageCarry` goes: `landingBand` asks
`carried` for the page. `readingBandMoves` credits each outer region's
glide with what it carries the region inside, and counts the region's move
from where that glide leaves it, for every outer region rather than the
page alone. `travelFrom` asks `carried` of each carrier, measuring the
element that carrier's scroll moves: past a fixed box Leaf anchors, that is
the anchor's holder (`carrying`), where `stuckBox` had climbed the fixed
box's own ancestors and never met the anchor's sticky boxes.

The measure reads only where each sticky box is drawn, so it reads a box
as riding no further once it sticks, though its own place returning, or
its holder's end arriving, would carry it on later in the scroll: that is
the distance a landing's band and moves need, and it needs no view timeline,
which Firefox can't read. Chromium and Firefox therefore agree. A box on
its line reads as stuck, as `stuckBox` reads it.

Before and after, Chromium and Firefox alike:

- the reproducer above: `landedBox` 118 -> 180 (landed at 180),
  `glideTravel` y -100 -> -38;
- `d m` typed quickly on a sidebar page whose track, standing 40px short of
  the line it sticks at, holds the only ask: the page ended at 50 where
  typed slowly it ends at 362; now 362 both ways. The track's ask read as
  leaving the window above, and `m` pulled the page back.

Still read wrong: the same pane stuck at 12, with the page gliding back to
0, comes back to 50 once its own place reaches the line, and the measure
has it stay at 12, as `travelFrom` read a stuck box before (`glideTravel`
null both before and after). From 100, `landedBox` read 280 before (62px
past where it landed, at 218) and 180 now (38px short); from 60, 240
before (22px past) and 180 now (38px short).

Test: `test_m_pressed_while_the_page_glides_lands_an_ask_in_a_sticky_track_where_it_lands_alone`
(test_obligation_walk.py), which fails on the base with 50 != 362 in both
engines.
…elling sticky layout

`carried` (geometry.js) modelled how far a scroll carries a node past its
sticky boxes, and a review found it wrong wherever a sticky box leaves its
line or is scaled: a pane stuck at 12 that a glide back takes home (read as
staying put), a holder's end pushing a pane 340px (read as 36), a
bottom-sticky box (140 or 260 against 400), scaled scrollers (13 against 38,
176 against 76), and a carry inverted as a scroll offset (a centre landing that
moved the page to 264 and left the destination at 12 where `landedBox` said
48). The other readers of a glide still credited its whole length. No model
can close this in Firefox, which can't read a stuck box's own place.

Leaf now asks the browser. `readScrolled` (arrivals.js) runs a reading with
boxes scrolled where the reading asks and puts every box back before the task
ends; Chromium and Firefox lay a box's content out as a scroll write lands, so
a read just after is exact. Each box costs a write and a write back, and owes
one `scroll` and one `scrollend` at the next rendering update. arrivals.js
hears scrolls before every other listener Leaf adds, and now stops a
`scroll` that finds its box, after a probe, where the last one found it, with
the `scrollend` after it, so no sequence starts and no keeper, anchored
surface or chooser of scroll positions reacts. Measured on a probe page in
Chromium 159 and Firefox 159: the page writes 6 scroll positions for two
`landedBox` readings, a window capture listener hears 2 events, a page
listener hears none, and no sequence starts. The probe still stops a smooth
scroll a script set going in the box (both engines); PageDown's runs on.

scroll-containers.js builds on it: `movedBy` (how far a scroll carries a
node), `whereGlidesLand` (read with the glides under way landed) and
`seekScroll` (the move that carries a node a given distance, or as far as it
rides before something holds it). Every reader moves onto them: `travelFrom`
(behind `glideTravel`, `heldTravel`, `glideGap`, `seenGlided`, `seenLanded`,
`seenAhead`), keeping the `carrying` walk past a fixed box Leaf anchors, which
takes a scroll only at the next frame; `readingBandMoves`, every region read
where the glides land and each region's move sought, innermost included;
`landingBand`'s cap; `alreadyArrived` (obligations/view.js); `makeRoom`
(comment-placement.js), which now takes the element its `clear` box measures;
and the New reply rise in thread-card.js. `carried`, `verticalTravel` and
`reachable` go.

A move goes no further than the one that would carry the box's content the
whole way, and stops where the destination stops riding. Seeking on past a
plateau, to where a holder's end pushes a stuck box, scrolled a stuck side
list's page 800px and took the open item's start away
(`test_a_side_list_longer_than_the_window_keeps_its_tab_and_open_item_in_view`,
both engines). So a destination stuck past a region's band stays where it is
when that move can't bring it back: a pane stuck at 12 under a band top of 60
stays at 40 rather than the page scrolling back 82px to free it.

Predicted against actual, head, identical in Chromium 159 and Firefox 159,
with the model's prediction in brackets:
- release, page 100 or 60 -> 0: glideTravel 36, moved 36 [0]
- holder's end, page 0->400: -340, -340 [-36]; a holder with no room: -400 [-36]
- bottom-sticky 0->400 and back: -400 and 400 [-140, 260]
- scale(0.5) scroller 0->200: -38 [-13]; scale(2) 0->100: -76 [-176]
- centre landing in a stuck region, band top 400, page gliding 0->300:
  landedBox 48, lands 48, page 0 [48, lands 12, page 264]
- centre landing on a stuck pane that isn't a region, page at 400:
  landedBox 12, lands 12, page stays [348, lands 12, page 64]
- a 900px sticky destination at 58 sticking at 12, band top 0: 12, 12 [0]

The shift watch skips a probe's scroll calls, which scroll nothing the user
sees: counted, one made inside a gesture's work marked its box as the
gesture's, and one from other work left the rendering unjudged.

Test: `test_m_pressed_as_g_g_glides_back_lands_an_ask_its_released_track_carries_down`
(test_obligation_walk.py), which fails on the model with 0 != 40 in both
engines.
…st stop

Two reviews of the probing commit found readings writing boxes nothing was
moving. `landingBand`'s cap scrolled the page from `alreadyShown` and
`landingRoom`, which margin-projection.js reaches from an IntersectionObserver
during the reader's own scroll: 40 readings during a page script's smooth
scroll from 900 to 200 made 21 writes to the root and stopped the scroll at
889 (Chromium) and 896 (Firefox). `seekScroll` wrote each region it sought a
move for, in landings and their predictions alike, and its search minimised
past the first stop. The event suppression keyed ownership on position, so a
fresh scroller's genuine first events could vanish, while window capture
listeners heard the probe anyway.

`readScrolled` (arrivals.js) now writes only the positions its one caller
names, and that caller, `whereGlidesLand` (scrolling.js), names only boxes a
glide holds, at their goals. Nothing is written at rest: the same 40 readings
now write nothing, and the script's scroll reaches 200 in both engines. The
glide's events carry the probe's, and its hold on the box's scroll sequence
keeps them from ending anything: a glide read 27 times across its frames heard
two more `scroll` announcements than the glide alone, the same one scroll end,
and landed at the same goal, in both engines. The suppression, `eventAt` and
`known` go.

A move is no longer sought. `carried` (geometry.js) is back as the read of a
move's first stop, now in the box's own scroll units through its transforms,
since a sticky box's insets are. `readingBandMoves` reads every region where
the glides land and moves each only to that first stop, and each region around
it finds the destination carried that far; a target that rides 100 and stops
moves the page 100, where the model moved it 350. `landingBand`'s cap,
`makeRoom` and the New reply rise in thread-card.js read the same way. The
comment side's reachable room (`roomTravel`, `reachableRoom`) takes its travel
from `carried` too, on the element its `extent` measures, which `choose` and
`commentSide` now take, but still counts from where the page stands: read
where an earlier glide was headed, `t` pressed as `m` set off opened its card
on the other side of its passage, which the walk's landing then left out of
the window (`test_a_key_pressed_during_a_glide_acts_where_the_glide_lands`,
m-t at once, both engines).

`travelFrom` reads all the carriers in one landing of the glides: each part of
the walk counts how far the glides move the element it carries less how far
they move the fixed box Leaf anchors ending it. `seenGlided` and `landed` read
clipping where the glides land, so an inner glide to 450 and an outer glide to
300 that bring a target into view leave it seen, where the inner clip as it
stood hid it. A node a glide past an anchored box carries is still cut by the
window alone, since that box takes the scroll at the next frame.

Predicted against actual, identical in Chromium 159 and Firefox 159 (the
model's prediction in brackets): glide travel for the release 36 [0], the
holder's end -340 [-36], a holder with no room -400 [-36], bottom-sticky -400
and 400 [-140, 260], scale(0.5) -38 [-13], scale(2) -76 [-176]. Centre landings
predict where they land: in a stuck region during a glide, 12 with the page
left at the glide's goal [48, landing at 12 with the page at 264]; on a stuck
pane, 12 [348]; on a 900px sticky destination, 12 [0]. The sidebar-track walks
(`d m`, `d d m`, `u m`, `g g m`, `d Tab`, `m m m`, `d u m`) end the same typed
quickly and slowly in both engines.

Remaining: a move reads a box on its line in its own place, and a box its
holder's end pushed past its line with no room left, as stopping at the line,
so the move stops short there (a centre landing during a glide ended at 36
where 0 was reachable). An author's sticky pane taller than the window, with
the ask at its foot, still leaves the ask at 1248 in a 900px window: reaching
it means crossing the plateau to the holder's end.

Test: `test_a_node_two_glides_bring_into_view_is_seen_where_they_land`
(test_geometry.py), which fails on the model with `ahead` False in both
engines.
…, and read landed clips whatever the travel

A review of c560fa0 found two cases where the landed reading of what the user
sees went wrong, both in Chromium and Firefox. A box Leaf anchors to the page,
as a thread card is, takes its anchor's glide only at the next frame, so
`seenGlided` cut a node in it by the window alone and dropped the card's own
clip: a word 200px down a 100px card read as seen where a page glide leaves the
card. 6123246 had cut it by that clip first; c560fa0 lost the cut when it
moved `landed` onto the landed reading. And `glideTravel` returned null where
the glides carry a node nowhere, so a pane's glide down taking back the page's
glide up, while they bring the pane's view over its target, left the target
read unseen.

`glideTravel` now answers whenever a glide carries a node, whatever the vector,
and names the anchored box past which a glide carries it (`held`), with how far
the glides inside that box carry the node. `seenGlided` cuts such a node by the
clips inside the box where its own glides land, then carries the cut box by the
anchor's glides and lets the window and the chrome's covers cut it; any other
node it reads where all the glides land, as before.

`carried` reads a flipped scroller's edges the other way round: under
`scaleY(-1)`, at scrollTop 150, it read 100 where the box sticks after 50, and
now reads 50, in both engines.

Remaining: a box touching its sticky line in its own place still reads as
stuck, so a move away from the line stops there (a `top: 0` box after 200px of
content, at scrollTop 200, won't be centred back to 100); telling the two apart
needs the box's own place.

Tests: `test_a_card_anchored_to_the_page_rides_its_glide_with_the_clip_it_holds`
and the `carried-nowhere` case of
`test_a_node_two_glides_bring_into_view_is_seen_where_they_land`
(test_geometry.py), which fail on c560fa0 with `held` True and `ahead` False in
both engines.
# Conflicts:
#	browser/runtime/geometry.js
#	browser/runtime/landing-scroll.js
leaf-agent
leaf-agent previously approved these changes Nov 23, 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.

This moves the glide case of #6481 onto one reader. whereGlidesLand now answers "where will the glide under way leave this box" for the six callers that used to work it out themselves. The issue's other motions still lack one: scrolls the browser or a script starts, and box-motion's carry, with the helpers it lists (followsEnd, scrollStarts, landGlides, scrollDrawn, CARRY, seenRect's rest flag). Could the description say Part of #6481 and name what's left, so the review of the last part can tell that it finishes the issue?

@max-sixty
max-sixty merged commit a489020 into main Nov 23, 2026
6 checks passed
@max-sixty
max-sixty deleted the carry-one-measure branch November 23, 2026 02:53
leaf-agent added a commit that referenced this pull request Nov 24, 2026
…tep (#6843)

`test_a_shared_passage_steps_between_single_thread_cards` pressed
**Previous thread** as soon as **Next thread** had focused the second
thread's reply. But a step lands on its thread the way every opening
does. In the same task that focuses the reply, it glides the passage
into the reading band (394 px on this page), and the card moves with the
page. When Playwright aimed the press before the glide ended, the press
fell on `<body>` where the button had stood. That moved the user's place
off the passage, and the card closed. This matches the call log in [run
45104895190](https://github.com/max-sixty/leaf/actions/runs/45104895190):
`not stable`, then `<body> intercepts pointer events`, then `element is
inert`, then `not visible` until the timeout. The test now calls
`scroll_settled` after each step, once the reply's focus shows the glide
has started, and presses the next step only then. It still asserts the
same behavior.

The glide predates the run's candidate PRs (#6810, #6688). A frame trace
at `017ddeccf` shows the same 394 px glide after Next, and the same
failure hit Linux on Nov 15 (#6048). So no change in
`017ddeccf..10ac9da` caused it.

<details><summary>Evidence</summary>

- A probe that presses where Previous stood before the step, once
`scrollY > 300`, closes the card every time. That is the failure's
mechanism.
- Without the change, the unmodified test passed 12 of 12 copies at
`--cpu-throttle 8` and 18 of 18 at `--cpu-throttle 16 --load 4`, so load
alone didn't reproduce the timing here. With the change, it passed 12 of
12 at `--cpu-throttle 8` and once unthrottled.
- The glide comes from `anchor-travel.js` `place` → `placeScroll` →
`landing-scroll.js` `scrollIntoView` → `glideTo`, in the same handoff
that calls `focusForNavigation` on the reply.

</details>

One product question remains open, and this PR doesn't decide it.
Opening this card from the margin marker leaves the page still. Stepping
to another thread **at the same passage**, which is already in view,
glides the page 394 px. The card moves with the page, so a pointer that
presses Next and then Previous misses Previous.

The stills below are from the test's page at 1440×900, with two threads
on the bracket question. In both alternatives the second thread is open
and its reply has focus.

| Before the step: thread 1/2, page at `scrollY` 0 | After Next,
**current**: the page glides to `scrollY` 394 | After Next,
**alternative**: the page stays at `scrollY` 0 |
|---|---|---|
| ![Before the
step](https://github.com/user-attachments/assets/1d8515e5-deed-44a3-b0b3-e308d801eb27)
| ![Current: the page
glides](https://github.com/user-attachments/assets/44465c21-a6a8-4683-abbf-9247a50d3e5d)
| ![Alternative: the page
stays](https://github.com/user-attachments/assets/8c7cfc5a-f29a-4f07-a1eb-02803ce3d4c1)
|
| Previous stands at y = 689 | Previous moves to y = 295. The passage
sits in the reading band | Previous stays at y = 689, under the pointer.
The passage and card stay low in the window, where they already were |

The alternative is a mock-up. It runs the current step and then scrolls
the page back to where it stood. It is not a built behaviour. Captured
with `leaf-dev probe` and a journey that presses Next and records
`scrollY` and Previous's box.

Closes #6838 — automated triage

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