Skip to content

Have a landing's glide re-read where the landing puts its box, with anchoring off while it glides - #6904

Merged
max-sixty merged 2 commits into
mainfrom
glide-survives-layout
Nov 23, 2026
Merged

max-sixty merged 2 commits into
mainfrom
glide-survives-layout

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

A landing's glide aimed at the offset the landing computed at the press, so layout that changed during the 140 ms glide left the destination off: 22px where content grew above it, an end landing clipped by its destination's growth, and, where two changes partly cancelled in the page's height, a glide that took scroll anchoring's move for a hand's and stopped. On the merge film at phone width, pressing "merge" then "setup" left the film 708px above the window. Now a landing passes its glide an aim that re-runs the landing's own arithmetic each frame, a later landing takes over the glides in the boxes it would move, and scroll anchoring is held off on a box while a glide moves it, so only a clamp's move counts as layout's.

To weigh: holding anchoring off is an exception to browser/AGENTS.md's "Leaf turns anchoring off on no box the reader reads in", which the diff rewrites; Max asked for that call to be made here. Between frames, a read of scrollGoal sees the last frame's goal, and comment placement and the thread card's reply placement still glide to a measured distance. Codex reviewed three rounds; its first replaced a node-following version.

Max asked for this after #6893. Tests: the five layout cases and the second-landing case in test_glides.py and the film's two-press phone test fail on main and pass here, in Chromium and Firefox. test_beacon.py::test_the_beacon_stands_once_the_comment_box_s_field_leaves_the_window fails locally on main too.

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

…nchoring off while it glides

A landing's glide aimed at the offset the landing computed at the press. Content that
moved the destination during the 140 ms glide left it off by the move: 22px in Chromium
and Firefox where growth sat above the destination, and an end landing whose
destination grew at its top clipped it by the growth. With scroll anchoring on, the
glide told anchoring's move from a hand's by how far the box's scroll height changed,
which two changes partly cancelling defeat: pressing the merge film's "merge" step and
then "setup" at phone width stopped the glide where it stood and left the film 708px
above the window.

Now a landing passes its glide an aim that re-runs the landing's own arithmetic
(`readingBandMoves`, or `innerMoves` inside `within`) at each frame and when a key lands
the glide, so the destination lands where the page's layout puts it as the glide ends,
with its alignment, band and clamps read afresh. A landing first takes the glides under
way in the boxes that scroll its destination (`steerGlide`), so a second landing that
moves nothing still owns the glide. Scroll anchoring is held off on a box while a glide
holds it, by an endless `overflow-anchor` animation (`holdBox`), so `holding` no longer
infers anchoring: only a clamp's move is layout's. browser/AGENTS.md's rule that Leaf
turns anchoring off on no box the reader reads in now states this exception; the
maintainer asked for this pairing to be decided here. HOLD_MOTION leaves endless
animations unheld, since they have no end for a test to step to or finish.

An earlier version followed the destination node's offset in the box's content. Codex
found it wrong for clamped landings, end, centre and nearest alignment, a moved band and
a rescaled box, since it was a second model of where a landing puts things; re-running
the landing's arithmetic replaced it. Codex also proposed letting a region the landing
didn't move join it when layout later needs it; no case built in a browser needed it,
since the page's own anchoring kept the region in view, so it isn't here.

Left as they are: a step or other read of `scrollGoal` between frames reads the last
frame's goal; comment placement and the thread card's reply placement still glide to a
measured distance; a numeric glide (`d`, `u`, `g`) lands at its offset with anchoring off
as it did with it on.

Tests: test_glides.py's layout cases (growth above the destination, below the window,
partly cancelling, and an end landing whose destination grows) and its second-landing
case fail on main in Chromium and Firefox and pass here, as does the merge film's phone
test, which now presses two steps. scrolling.test.mjs covers the aim and the narrower
ownership check.

@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.

#6896 also edits scrollIntoView's within path in landing-scroll.js: it removes the block handling for a within box, and this PR's landingAim passes block to innerMoves in that same path. Whichever lands second has to rebase onto the other's within path.

@max-sixty
max-sixty merged commit b2e79bb into main Nov 23, 2026
6 checks passed
@max-sixty
max-sixty deleted the glide-survives-layout branch November 23, 2026 21:53
max-sixty added a commit that referenced this pull request Nov 23, 2026
… as the page glides (#6908)

Two glides still aimed at a distance measured once: the comment card's
room-making glide (`makeRoom`) and the thread card's glide that brings
the user's turn into sight above New reply (`#fitAnswer`). With scroll
anchoring held off during glides since #6904, layout that changed during
the glide left each short: a card opening under its passage during a
landing's glide got 150px less room than it asked for when 150px grew
above the passage, and the turn ended 140px under New reply when a
message above it grew 150px. `makeRoom` also replaced the landing's
glide with a numeric one, dropping the landing's aim.

Now a glide keeps its base (where its landing puts the box, or the
offset asked for) apart from one placement distance (`glideBy`), which
it reads with the box at the base at each frame. A later landing clears
the placement, a later placement replaces it, and `makeRoom` re-reads
what the card stands clear of (`attachmentClearance`, split out of
`commentAttachment` so a frame scans no margin rows) through a function
that answers false once the card closes.

To weigh: a placement whose goal clamps at the box's end still leaves
the box to it when a keeper asks for the end, as a landing's glide
already did.

Max asked for this after #6904. Tests: the new cases in `test_glides.py`
and `test_card_reply.py` fail on main in Chromium and Firefox and pass
here; `scrolling.test.mjs` covers the base and placement arithmetic.

> _This was written by Claude Code on behalf of max-sixty_
max-sixty added a commit that referenced this pull request Nov 24, 2026
…current API

Main's follower is still the resting one #6008 landed; it moved its imports to
the library and landing-scroll.js gained a glide's aim (#6904). Three files
conflicted, each resolved to main's text with this branch's change made again:

- packages/default/widgets/lf-code.js: main's imports, with `alreadyShown` and
  `scrollIntoView` dropped. `setScroll` left the package API (#6951), so the
  follower writes the pane's scroll with the browser's own `scrollTo`, asking
  `scrollMoves` (lib/scroll-range.js) first, as module-scroll-and-motion.md
  asks of a writer that may name the position its box holds. A line out of the
  band at an end of the pane is such a write.
- browser/runtime/landing-scroll.js: `innerMoves` loses its `block` again and a
  `within` box lands at once, nearest. The glide's aim (`landingAim`) and the
  boxes a landing steers ask `innerMoves` without it.
- browser/runtime/widget-api.js: main's exports, plus `alreadyShown`, which
  portable-api.js no longer exports and lf-trace reads.

skills/leaf/references/module-scroll-and-motion.md merged clean and named
`setScroll`; it names `scrollTo` now.
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