Skip to content

Act on a key pressed during a glide as though the glide had landed - #5971

Merged
max-sixty merged 1 commit into
mainfrom
motion-ahead
Nov 14, 2026
Merged

max-sixty merged 1 commit into
mainfrom
motion-ahead

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

A key pressed while one of Leaf's glides runs now acts as it would once the glide had landed, the rule Max chose. On main, with focus on a link mid-page, g g or d then c opened a comment box on the link that the glide carried off screen with focus inside it, and g g then Tab moved on from the link and took the page back down. Now c opens the panel's comment and Tab starts from the page's top, as both do after landing, in Chromium and Firefox.

The readings of where the user is read the page mid-glide. Each now reads it where the glides will leave it, through seenGlided in scroll-containers.js, moved there from landing-scroll.js's alreadyShown: focusPlace, walkOrigin, and the reading block a let-go lands on (blocksOnScreen(..., ahead)). capturePlace keeps the page as it stands, since a revision's restore moves the page from there.

Where to look: a nearest landing that leaves a box where it is now stops that box's glide, so Tab during g g keeps the link it reaches in view; walks, travel and keepInBand are unaffected. glideTravel no longer counts a scroll a node sticks in. Chromium's own focus reveal still leaves t then Tab 133 px short; that's separate.

Tests: the g g browser test now presses c and Tab as the glide sets off (fails on main), runtime assertions for a glide carrying focus away and a stuck heading, check:browser, test:runtime, 20 focused browser cases, and the survey in both engines.

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

Max chose this rule (#6.3.2, option B) after a survey of glide keys followed
straight away by `c`, Tab or `t`, compared with the same key pressed once the
glide had landed. On main, with focus on a link mid-page, three pairs
diverged because the readings of where the user is read the page mid-glide:

- `g g` or `d` then `c` opened a comment box on the link, and the glide
  carried it off screen with focus in it. Once landed, `c` opens the panel's
  comment.
- `g g` then Tab moved on from the link to the next control and took the page
  back down to it. Once landed, Tab starts from the page's top.

Each reading now asks where the glides under way will leave things, through
one reading in scroll-containers.js: `seenGlided` (what the user will see of
a box: moved by the glides' remaining travel, then cut by the scrollers,
window, sticky headers and chrome there), moved from landing-scroll.js, where
`alreadyShown` already asked it; and `seenAhead`, whether any of a node will
be in front of the user, or the glides carry it toward the window, the
tolerance #5958 measured for a card's trailing box.

- `focusPlace` counts focus only where the glides leave it seen, so a key
  pressed as `g g` sets off lets go of the link.
- `walkOrigin` and its let-go record, and `landingPlace`, ask `seenAhead`.
- `readingBlock` reads the blocks at the glide's goal
  (`blocksOnScreen(..., ahead)`, with `heldTravel` counting a pane's own
  glide), so a let-go lands where the reader will read. `capturePlace` keeps
  reading the page as it stands, since a revision's restore moves the page
  from where it is.

Two changes go with it. `glideTravel` no longer counts a scroll a node sticks
in, so a let-go or walk read during a glide keeps a control in a sticky
header. And a nearest landing that leaves a box where it stands stops that
box's glide: Tab during `g g` focused the link the glide was carrying away,
which the landing found in view and left, so the page reached the top with
focus on the off-screen link. Walks and travel land at a start or centre and
leave glides alone, and `keepInBand` ignores the stop, so a keystroke leaves
a transcript gliding to its end.

Known limits, stated in the comments: a region that a glide around it carries
is read with its bounds where they stand now, and a glide inside a glide reads
the inner box's clip where it stands now. Chromium's own focus reveal still
leaves `t` then Tab 133 px short of the walk's landing.

Behavior changes: `g g c` opens the panel's comment at the top, and `g g`
Tab focuses the first control at the top, in Chromium and Firefox. Tests: the
`g g` browser test now presses `c` and Tab as the glide sets off (both fail on
main's runtime); runtime assertions cover a glide carrying a seen control
away and one leaving a stuck heading in place.
@max-sixty
max-sixty merged commit f11c8cf into main Nov 14, 2026
4 of 5 checks passed
@max-sixty
max-sixty deleted the motion-ahead branch November 14, 2026 21:47
max-sixty added a commit that referenced this pull request Nov 15, 2026
…nds (#5987)

A nightly journey holds Leaf's glides to the rule Max chose in #5971: a
key pressed while a glide runs acts as it would once the glide had
landed. From a link mid-page, each of `t`, `m`, `g g` and `d` sets off
and each of `c`, Tab, Shift+Tab, `t`, `m` and `d` follows, in Chromium
and Firefox, once before the glide's first frame (frames held) and once
after it lands; focus, whether it's seen, and the scroll must agree.
Comparing the two arms needs no expected outcome per pair, so only a
mid-glide reading of where the user is shows up. On the runtime before
#5971 it fails 6 pairs per engine that pass now.

Where to look: it finds 6 pairs that still break the rule, marked xfail
as defects with their causes. Tab or Shift+Tab during `t`, `m` or `d`
leaves the page elsewhere, because the reveal of the control Tab reaches
reads the page mid-glide; and `c` during `m` brings the ask forward from
where the glide has it. `t` then Shift+Tab varies with frame timing, so
that one is non-strict. Each case is ~3 s, inside the browser tier's
budget, but the 48 cost about 2.5 CPU-minutes, so they run daily by
Max's choice.

Tests: the full matrix 10 times locally and once on CI (stable: 37 pass,
9 xfail, and `t` then Shift+Tab varying), Chromium at `--cpu-throttle
10`, and the pre-#5971 runtime as the bug-back control.

> _This was written by Claude Code on behalf of max-sixty_
max-sixty added a commit that referenced this pull request Nov 15, 2026
Max asked for one rule for keys pressed during a glide instead of a
decision per case. It is the one #5971 recorded: a key acts as it would
once the glide had landed; a wheel or touch takes the page where it
stands. The nightly check from #5987 holds every glide-and-key pair to
it, and now passes 55 of 56 cases, PageDown included.

Leaf's readings of where the user is already predict the landing. What
failed was work that reads the page as it stands, now handled one of two
ways:

- **Land first**: the browser's answer to Tab and paging keys
(`landForKey`, called by the keyboard controller after its let-go), and
the comment box's Floating UI placement for a page target or selection
(`landGlides`). The glide's last ≤140 ms of motion jumps.
- **Aim from the goal**: Leaf's nearest reveals measure each region
where its glide will leave the destination (`readingBandMoves`). This
replaces #5971's rule that such a reveal stops the glide, which left `/`
during `d` in a diff stopped mid-way.

Where to look: landing on every key was tried and rejected, since a
CSS-anchored thread card takes a scroll a frame late and a card a `t`
walk had focused read as off screen. That lag is also why Chromium `t`
then Tab still fails.

Tests: a runtime test and a browser phase that both fail on main, 253
focused browser tests, `test:runtime`, the matrix twice; Codex reviewed
twice and its four findings are fixed.
`test_a_focused_thread_covers_the_pages_choice_hints` 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