Skip to content

Let a glide go on when scroll anchoring or a clamp moves its box, and start the merge film's glide at once - #6893

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

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

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

A glide, the smooth scroll Leaf drives itself (glideTo in browser/runtime/scrolling.js), read any move of its box away from where it last wrote it as another hand's scroll and stopped. Scroll anchoring makes such a move whenever content grows above what the reader sees, so a widget that lands something smoothly in the same task as a redraw lost its landing. On the wt-merge film at phone width, with the next-frame workaround from #5981 taken out, a step's press grew the step list 22px, anchoring moved the page 799 → 821, and the film ended 786px out of view in 3 of 3 runs. Now a glide keeps its box through anchoring (a move equal to the box's scroll-height change) and a clamp (the box moved back to its new end), and goes on from where layout left it; any other move is still a hand's. The film lands with its top at 39px in Chromium and Firefox, so this also drops its workaround and the package-data.md sentence telling a producer to scroll in the next frame.

To weigh: the goal is still the offset computed at the press, so a destination the growth itself moves (one below it) lands off by the growth, as on main when the box doesn't move. Geometry can't separate every hand from layout: a script's scroll in the same frame that matches the height change exactly reads as layout's. Codex reviewed three rounds; an earlier draft that re-asked each landing's goal was dropped for the gaps it left.

Max asked for this on the widget-composition page. Tests: test_glides.py (Chromium, Firefox) and the film's phone test fail on main's scrolling.js and pass here; scrolling.test.mjs covers anchoring, a clamp and a hand. Navigation, geometry, thread, margin, widget and control browser tests and the glide journeys pass.

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

A glide, the smooth scroll Leaf drives itself (`glideTo` in
scrolling.js), treated any move of its box away from where it last
wrote it as another hand's scroll, and stopped there. Scroll anchoring
makes such a move whenever content grows above what the reader sees, so
a widget that landed something smoothly in the same task as a redraw
that grew content above the window lost its landing.

The case that showed it is the wt-merge film on #5981's branch at phone
width, with its next-frame workaround (`frameFor` around its
`scrollIntoView`) taken out. A step's press redrew the step list 22px
taller, anchoring moved the page from 799 to 821, the glide stopped
before its first frame, and the film ended 786px out of view in 3 of 3
runs. On main, a page that grows a box between a heading and the window
as it lands the heading smoothly stops the same way, at the glide's
start or mid-way, in Chromium, Firefox and WebKit.

What changes, in `holding` and the tick:
- A glide keeps its box where the box moved by what its scroll height
  changed (anchoring for a single change), or where the box stands at
  the end its scroll height gives once that end no longer reaches the
  glide's last write (a clamp). Any other move is still a hand's, also
  in a frame where layout changed. An earlier draft that kept any move
  no larger than the height change let a glide take back the browser's
  scroll to an element a script focused, which
  test_an_inner_scope_shadows_an_outer_one_binding_by_binding caught.
- Each frame covers the eased share of the way left from where the
  glide last had the box, unrounded, so a glide layout moved goes on
  from there and still lands on time. Where nothing moves this is the
  same curve as before, and a glide taking over the browser's own
  scroll eases as before until its first write moves the box.

What it leaves:
- The goal stays the offset computed at the press. A destination that
  the growth itself moves, such as one below it, lands off by the
  growth (22px in the probe), as it does on main whenever the box
  doesn't move. Reaching it exactly needs the landing to own its
  destination and re-resolve it during the glide. A first try that
  re-asked each box's goal on height changes missed nested regions,
  heights that cancel, a second landing that moved nothing, and keys
  pressed before the next frame, so it is not in this change.
- Geometry can't tell every hand from layout. Anchoring for two changes
  that partly cancel in the box's height still reads as a hand's and
  stops the glide, as on main. A script's scroll in the same frame as a
  layout change, by exactly what the height changed or to exactly the
  end a shrink left, reads as layout's, and the glide takes the box
  back. Codex built both from probes; neither arises from a single
  widget's redraw.

Tests: test_glides.py, in Chromium and Firefox: a press that lands a
heading smoothly while growing content between the heading and the
window leaves the page where an instant landing would. It fails on main
in both. scrolling.test.mjs: a glide goes on through anchoring and a
clamp, and stops for a hand's move, with or without layout changing in
that frame. On #5981's branch with this change and the film's workaround
removed, test_a_step_pressed_on_a_phone_brings_the_film_into_view
passes (it fails without the change), and the film lands with its top
at 39px in Chromium and Firefox.

Also run: tests/browser/navigation, test_scroll_writes, test_geometry
(339 pass); tests/browser/threads, margin, widgets, controls and
test_render_floating_panel (all pass but
test_obligation_action_binding_badges_use_the_available_card_action_seats,
which fails on main too); the glide cases under tests/journeys (127
pass); pnpm run test:runtime and check:browser.

> _This was written by Claude Code on behalf of max-sixty_
…xt-frame advice

With a glide going on through scroll anchoring, the wt-merge film no
longer needs to start its smooth scroll a frame late, after the step
list has drawn: it lands at phone width when it starts at once, which
test_a_step_pressed_on_a_phone_brings_the_film_into_view checks (it
fails with main's scrolling.js and this film). package-data.md drops the
sentence telling a producer to scroll in the next frame after its
`change`, whose only reason was that glide.

> _This was written by Claude Code on behalf of max-sixty_
@max-sixty
max-sixty merged commit 9da5040 into main Nov 23, 2026
6 checks passed
@max-sixty
max-sixty deleted the glide-survives-layout branch November 23, 2026 20:03
max-sixty added a commit that referenced this pull request Nov 23, 2026
…nchoring off while it glides (#6904)

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_
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