Skip to content

Keep landings off the anchor walk, and give that walk a home beside scrollersOf - #5895

Merged
max-sixty merged 2 commits into
mainfrom
scrollers-follow-anchors
Nov 14, 2026
Merged

max-sixty merged 2 commits into
mainfrom
scrollers-follow-anchors

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

#5841 let focusPlace follow a fixed box's position-anchor past where scrollersOf stops, and left open whether scrollersOf itself should, so landings, holds and returnTo would see the page scroll that carries a card. This settles it: no. The anchor walk moves beside scrollersOf as carriersOf, for questions about motions under way, and scrollersOf's comment records why landings stay off it.

With scrollersOf following anchors (tried, not kept), t then Tab before the walk's glide ended left the margin card wholly above the window with focus in it; main keeps it on screen. The landing read the card where its last placement left it: in Chromium, Firefox and WebKit a scroll moves an anchored box only at the next rendering update, and the card's placement re-solves after a scroll, changing plane. Native wheel chaining also passes from a fixed card to the root, not to its anchor's pane.

One behavior change: holdUserPlace now yields to a browser-run scroll in any box carrying the place (carriersOf). In a probe with an anchored box whose own content scrolls, main scrolled that content back 116 px against a smooth page scroll. Leaf's cards rarely reach this, since a card that fills its room is unanchored.

Max asked for this as a follow-up to #5841; Codex reviewed the conclusion and found the hold case. Tests: check:browser, test:runtime, #5841's two tests and the card, seated-thread and arrival hold tests.

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

…crollersOf

#5841 taught `focusPlace` to follow a fixed box's `position-anchor` past the
point where `scrollersOf` stops, so a key pressed during the thread walk's
glide stays on the card the walk reached. It left open whether `scrollersOf`
itself should follow anchors, so that landings, holds and `returnTo` also see
the page scroll that carries a card. It should not.

With `scrollersOf` following anchors (an experiment, not kept), pressing `t`
then Tab before the walk's glide ended left the margin card wholly above the
window, its foot 120 to 260 px past the top, with focus on a control in it.
On main the card ends on screen. The Tab arrival's nearest landing read that
control at y=1905 in a 900 px window and moved the page by 1055 px, because:

- A scroll moves an anchored fixed box only at the browser's next rendering
  update. Chromium, Firefox and WebKit all return the old position to a read
  in the same task.
- The card's placement solves again after a scroll and changes plane. A
  landing on a reply cut by the window's foot moved the page 101 px as though
  the card rode it; the card then stood at the window's edge, 63 px below
  where that move aimed it. Main moves nothing there, and off-flow.js brings
  a surface back by landing what it stands by.

Native scroll chaining ends at the fixed box too: in all three engines a
wheel spent in a fixed card's inner scroller passes to the root scroller, not
to the pane carrying the card's anchor, so `scrollChainOf` must not follow
anchors either.

The anchor walk answers which motions under way carry a node. It moves from
`user-place.js` into `scroll-containers.js` as `carriersOf`, beside
`scrollersOf`, whose comment now records the rejected alternative and no
longer says a fixed box stands still while the page scrolls.

One more caller asks that question: `holdUserPlace` yields to a scroll the
browser is still running in the boxes moving the place, and now asks it of
`carriersOf`. On main, for a focused control in a box Leaf anchors whose own
content scrolls, a reading that arrived during a smooth page scroll scrolled
that content back by the page's travel, 116 px in a probe; now the hold
yields. Leaf's own cards rarely reach this, since a card that fills its room
stands in the window's plane, unanchored.

Tests: `pnpm run check:browser`, `pnpm run test:runtime`, the two tests that
pin #5841's behavior, the card, seated-thread and arrival hold tests, and
#5841's region and margin-carrier probes, identical on base and head.

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This overlaps #5863, which edits the same yield in holdUserPlace. There, the hold also yields to a scroll chosen since the reading (chosenSince), and only for boxes from scrollersOf(holderOf(place)). Whichever PR lands second should run both reads over the same boxes. If browserScrolls walks carriersOf and chosenSince walks scrollersOf, a hold on a place inside the card yields to a page scroll the browser is still running, but not to a page scroll a landing chose.

@max-sixty
max-sixty merged commit 8fa80aa into main Nov 14, 2026
5 checks passed
@max-sixty
max-sixty deleted the scrollers-follow-anchors branch November 14, 2026 18:21
max-sixty added a commit that referenced this pull request Nov 14, 2026
… it lands (#5958)

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