Skip to content

Read a glide's remaining travel in one place, and let a key act where it lands - #5958

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

max-sixty merged 2 commits into
mainfrom
motion-ahead

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Three readings asked where Leaf's glides under way will take a node, each its own way. They now share glideTravel and glideGap in scroll-containers.js: the distance the glides have still to scroll every box carrying a node (carriersOf, so the page's glide carries a thread card), and how far outside the window the node stands now and once moved by it. Each caller keeps its own question.

Two behaviors change:

  • focusPlace counts a glide only while it carries focus toward the window. On main, with focus on a link mid-page, g g then c once the link has left the window takes the page back down and comments on the link. Now c opens the panel's comment at the top, as it does once the glide has landed (Chromium and Firefox).
  • off-flow.js leaves an unseen surface to a glide that will bring it into the window. On main, t then c brings the card back mid-walk and stops the page 360–375 px short of the walk's landing; now it lands where t alone lands, and t then Tab does too in Firefox. Chromium's own focus reveal still moves the page on t then Tab.

Where to look: focus uses "toward" and off-flow uses "into" because they fail differently (a card's box trails its placement mid-walk; a suppressed reveal is never retried), which the commit message details. alreadyShown keeps its rule; holdUserPlace is untouched (it asks whether any scroll moved the place, browser-run ones included).

Max asked for this as #6.3.3, the follow-up to #5895. Codex reviewed three rounds; each found a defect in predicting where a node will stand, which led to this design. Tests: a runtime assertion, a new g g then c browser test and a stricter #5841 walk test, both failing on main's runtime; check:browser, test:runtime, 25 focused browser cases.

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

… it lands

Three readings asked where Leaf's glides under way will take a node, each its own
way: `alreadyShown` walked the node's scrollers, `focusPlace` counted any glide in
the boxes carrying it, and off-flow.js asked only where a surface stands now. They
now share `glideTravel` (scroll-containers.js): the distance the glides have still
to scroll every box carrying a node (`carriersOf`), as a vector on screen through
each box's transforms, and `glideGap`: how far outside the window the node's box
stands now and once moved by it. Each caller keeps its own question:

- `alreadyShown` keeps its rule, seen now and where the glides leave it, and its
  clipping, now with the travel's sideways part and the page's glide carrying a
  thread card.
- `focusPlace` counts a glide while it carries the focused node toward the window
  or into it, as its comment said ("carrying them to it"). Before, a glide carrying
  focus away kept it the user's place until the glide ended: with focus on a link
  mid-page, `g g` and then `c` once the link had left the window took the page back
  down and opened the comment box on the link. Now `c` acts from what the user
  sees, as it does once the glide has landed (Chromium and Firefox).
- off-flow.js leaves a surface the user doesn't see to a glide that will bring it
  into the window, and brings it back otherwise. `t` then `c` back to back brought
  the card back while the walk was still gliding it in, stopping the page 360 to
  375 px short of the walk's landing; now the page lands where `t` alone lands,
  and so does `t` then Tab in Firefox. In Chromium `t` then Tab still stops short:
  its own focus reveal scrolls the root for a control in an anchored fixed box.

Focus takes toward and off-flow takes into because they fail differently. A card's
box trails its placement while the walk glides it in, and read where the glide
would carry it, it can stand a pixel past the window, so "into" let go of the card
mid-walk. A reveal suppressed by "toward" is never retried, so a box an edit asked
for stayed hidden behind a glide that stopped short of it or carried it past.

Rejected, after Codex's reviews: predicting where the node will stand for focus
and off-flow. Projecting its own clipped box dropped focus mid-walk, dropped it in
a pane and page gliding together, since the pane's cut was read where it stood,
and lost a rotated pane's sideways travel. Reading a box Leaf anchors by its anchor
misread a comment box whose anchor is its pane's first character, so typing
during the pane's glide redirected the glide.

The hold in `holdUserPlace` asks a different question, whether any scroll has
moved or is moving the place, browser-run ones included, which have no goal to
read, so it stays on `carriersOf`.

happy-dom returns "" for an unset rotate, scale, transform or zoom, which
element-axes.js read as NaN; the test world's computed style now gives their
initial values.

`focusPlace` with focus scrolled away costs 0.005 ms a call on a plain page and
0.06 ms with a thread card, as on main.

Tests: a runtime assertion that a glide carrying focus away lets go of it; a
browser test for `g g` then a late `c`; the #5841 walk test now also asserts the
page lands where `t` alone lands. Both browser tests fail on main's runtime.
`check:browser`, `test:runtime`, and 14 focused browser tests (25 cases) on keys
during glides, letting go of scrolled-away focus, card bring-back and holds.
Probes, base against head in both engines: focus kept every frame through `t` and
through a nested block-and-page landing; typing in a comment box during a block
glide leaves the glide alone; an edit in an off-screen comment box during a glide
that stops short, passes it, or brings it in reveals it as main does.
# Conflicts:
#	browser/runtime/user-place.js
@max-sixty
max-sixty merged commit 6ccf3ff into main Nov 14, 2026
5 checks passed
@max-sixty
max-sixty deleted the motion-ahead branch November 14, 2026 20:08
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