Repository navigation
Read a glide's remaining travel in one place, and let a key act where it lands - #5958
Merged
Merged
Conversation
… 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
leaf-agent
approved these changes
Nov 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three readings asked where Leaf's glides under way will take a node, each its own way. They now share
glideTravelandglideGapinscroll-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:
focusPlacecounts a glide only while it carries focus toward the window. On main, with focus on a link mid-page,g gthenconce the link has left the window takes the page back down and comments on the link. Nowcopens the panel's comment at the top, as it does once the glide has landed (Chromium and Firefox).tthencbrings the card back mid-walk and stops the page 360–375 px short of the walk's landing; now it lands wheretalone lands, andtthen Tab does too in Firefox. Chromium's own focus reveal still moves the page ontthen 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.
alreadyShownkeeps its rule;holdUserPlaceis 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 gthencbrowser test and a stricter #5841 walk test, both failing on main's runtime;check:browser,test:runtime, 25 focused browser cases.