Skip to content

Land a walk pressed while a glide runs where the glide is headed - #6030

Merged
max-sixty merged 2 commits into
mainfrom
motion-ahead
Nov 15, 2026
Merged

max-sixty merged 2 commits into
mainfrom
motion-ahead

Conversation

@max-sixty

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

Copy link
Copy Markdown
Owner

The glide matrix from #5987 pressed each key only before the glide's first frame. Pressed mid-glide with real timing, t again during a t walk left the page short of the thread (Firefox 12 of 12 runs, Chromium 8 of 10): every arrival stopped Leaf's glides and landed nearest from where the page stood, where the thread was already in view.

  • An arrival now stops only a scroll the browser drives (stopBrowserScroll); a glide of Leaf's goes on, and the landing aims from its goal, as Act on every key pressed during a glide where the glide lands #6009 made the reading band do. Back and Forward still stop glides.
  • g lands the glides instead of stopping them, as c and Tab do.
  • An instant landing takes the box from a glide, landing it now where the glide already headed for the destination; a sideways reveal on the way leaves a vertical glide going (landing-scroll.js).
  • The matrix presses each key at once and under way, two frames after the glide first moves; held_frames freezes the page's frame clock and yields step(), so that point doesn't drift with load. g joins the keys. 127 of 128 pass in both engines; on the base, t t and m t under way and every glide then g fail.

Where to look: the one known case, Chromium t then Tab at once, is an engine gap now recorded in notes/browser-support.md: an anchored box takes a script's scroll at the next frame, and Chromium reveals a control in one by scrolling the page.

Also fixes test_a_focused_thread_covers_the_pages_choice_hints on macOS 26's fonts.

Max asked to work through #6009's open items. Tests: the matrix, real-timing t t (38 of 38 runs end as typed slowly), runtime tests for both landing fixes (fail on main), 61 focused browser tests, test:runtime, check:browser. Codex reviewed it.

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

The glide matrix from #5987 pressed each key only before the glide's first
frame, where every pair passed. Pressed with real timing instead, `t` again
20-100 ms into a `t` walk's glide left the page where the second press found
it, short of the thread: 12 of 12 such runs in Firefox and 8 of 10 in
Chromium. Every arrival stopped Leaf's glides before it landed
(anchor-travel.js, `arrive`), then landed nearest from where the page stood,
and mid-way the thread was already in view, so it moved nothing. `g` did the
same: arming the Go-to map stopped the page's glide where it stood.

An arrival now stops only a scroll the browser drives, such as a wheel's or
PageDown's, whose end no script can know (scrolling.js, `stopBrowserScroll`).
A glide of Leaf's goes on, and the landing measures from where it is headed
and takes it over, as #6009 made the reading band's moves do
(landing-scroll.js, `readingBandMoves`). A return still stops the glides
itself (history.js), since it goes back to a place. `g` lands the glides,
as `c` and Tab do (`landGlides`), so its map labels the page the walk leaves.

Two more landings let go of where a glide was headed (landing-scroll.js).
An instant landing whose destination the glide already headed for left the
glide to finish, so a replaced view, which lands instantly so as never to
paint at the old view's offset, painted at the glide's for up to 140 ms; it
now lands the glide at once. And the walk that brings a destination in
sideways before its reading region lands stopped the glide with its instant
horizontal write, so the region's landing measured from where the page stood
rather than where it was headed. An instant landing now stops a glide only
where it moves the box down or up. tests/runtime/landing-scroll.test.mjs
holds both, and both fail on main.

The matrix now presses each key at two points in the glide: at once, and
under way, two frames after the glide first moved the page. `held_frames`
(render_harness.py) freezes the page's frame clock while held and steps one
frame at a time, so "under way" lands at the same fraction of the glide on a
loaded host. `g` joins the keys. 127 of the 128 cases pass in both engines;
on the merge base, `t t`, `m t` under way and every glide followed by `g`
fail. The Chromium `t` then Tab case stays known: an anchored box takes a
script's scroll at the next frame in both engines (a probe read it 200 px
behind in the same task), and only Chromium reveals a focused control in
such a box by scrolling the page. notes/browser-support.md records that gap
in its entry on anchored fixed boxes, whose recheck now covers this case.

test_a_focused_thread_covers_the_pages_choice_hints failed on this Mac:
under macOS 26's Charter the card covers the chip's lower half and its
centre fell 2.5 px above the card's top edge. It now reads the paint at the
centre of the overlap, which still fails if the chip paints over the card.
leaf-agent
leaf-agent previously approved these changes Nov 15, 2026
Codex's second review found that the previous commit let an instant landing
stop a glide only where its write moved the box vertically, so a landing on
a destination centred where the page stood, with the glide about to carry
it 1000px up, wrote nothing and left the glide to carry it away. An instant
landing now stops the glide unless it only moves the box across, the
sideways reveal the walk before a reading region makes. The runtime test
gains that case, which fails on the previous commit.
@max-sixty
max-sixty merged commit 5cc9aef into main Nov 15, 2026
5 checks passed
@max-sixty
max-sixty deleted the motion-ahead branch November 15, 2026 18:02
leaf-agent added a commit that referenced this pull request Nov 15, 2026
… it carries (#6074)

Clicking a commented passage during a `t` walk's glide opens that
passage's thread but no longer keeps the page on it. The walk's glide
keeps going and carries the clicked words out of the window. That breaks
`test_a_thread_trip_takes_over_an_outgoing_trip_before_its_first_frame[passage]`
on every run since #6030.

**Cause.** A click on a mark opens its thread with `travel: false`
([surface.js](https://github.com/max-sixty/leaf/blob/ac5dba8ffcf40f60babc30895ec495d4f6925935/browser/runtime/composing/surface.js#L1306)).
The only landing that arrival makes is the thread card's. The card is a
fixed box anchored beside its passage, so `scrollersOf` yields no
scroller for it, and `scrollIntoView` on it moves nothing. Before #6030,
`arrive` called `stopScroll`, which stopped every Leaf glide, and that
is what used to end the walk. #6030 replaced it with `stopBrowserScroll`
so that `t` pressed mid-glide lands where the glide is headed. After
that, nothing on the click route stopped the glide. An instrumented run
showed the card's landing reading `alreadyShown` as false (the glide
would carry the card away) and then making no move.

**Fix.** The click handler now stops the glides in the boxes that carry
the clicked words (`carriersOf`) before opening the thread. The press
picked those words where they stood, the same reason `z` stops a glide.
The change is limited to the pointer route. Keys keep #6030's rule that
a landing aims from the glide's goal.

**Verification.**
- The failing test fails on main (`assert 0 <= -2158.921875`) and passes
with the change (3 of 3). Its `[walk]` variant still passes.
- #6030's mid-glide matrix
(`tests/journeys/navigation/test_reading_place.py::test_a_key_pressed_during_a_glide_acts_where_the_glide_lands`,
Chromium): 63 passed, 1 xfail (the `t`-then-Tab engine gap #6030
recorded).
- `pnpm run test:runtime` and `pnpm run check:browser` pass.
- The click, press, mark and trip tests in `test_comment_marks.py` and
`test_threads.py` pass, apart from
`test_color_cues_fade_to_the_live_surface[firefox_browser]`. That test
also fails on main with a Firefox color-serialization difference, so
this change doesn't cause it.

Closes #6072 — automated triage

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