Skip to content

Credit a margin row's frame-late catch-up to its anchor's scroll in the shift watch - #6763

Merged
max-sixty merged 2 commits into
mainfrom
shift-watch-anchor-lag
Nov 22, 2026
Merged

max-sixty merged 2 commits into
mainfrom
shift-watch-anchor-lag

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

The shift watch, the tests' check that nothing on the page moves without input, reported a margin row's catch-up after a scroll no input makes as a move. Chrome applies an anchor's scroll to the boxes it carries after the frame's callbacks, where the watch reads, so one reading finds the anchor scrolled and the carried row a frame behind. The watch credited that lag only while the row's carrier kept its pose, and the margin's pass rewrites a carrier's inset on every pass after a scroll, so the catch-up went uncredited. Every frame of a smooth scrollBy no input makes failed the same way. The painted row never moved. This is on main; #6688's trace journey hit it when Playwright's hover scrolled the page 9px, and #6688 now points the pointer without scrolling instead.

The watch's anchor credit now first looks for scroll travel of the anchor over which the row kept its offset from it, allowing each end of the move to read the anchor as it stood one reading earlier (laggedTravel, +37 lines), and otherwise credits as before. A second commit corrects margin-layout.js's header, which said a pass after a scroll writes the same insets: a carrier's are measured from the window, and placeCarriedRows relies on the new value to make WebKit and Firefox resolve an anchor again after a scroll inside a scaled box. Anchor-relative insets would end the rewrite but broke the scaled-slide test in WebKit.

To weigh: the lag credit allows one reading's lag at each end and no more, since on a smooth scroll a longer window matched a slowing frame against a speeding one and credited a real move.

Tests: the new test_a_carried_row_keeps_its_anchor_s_lagging_scroll covers a step scroll and a smooth scroll, each with a rewrite during the lag; both failed on the old watch and pass now, at CPU throttle 0, 4 and 8, and a row placed 5px off is still reported. The watch's 82 existing anchor and scroll cases pass, and #6688's trace journey passes 4 of 4 with hover restored at throttle 4.

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

Chrome applies an anchor's scroll to the boxes anchored to it after the
frame's callbacks, where the shift watch reads. So after a scroll no input
makes, a reading can find the anchor scrolled and what it carries where the
anchor stood a reading before, and the next reading finds the box caught up.
The watch credited that catch-up only while the anchored owner kept the pose
it had before the scroll. A script that wrote the owner again in that frame,
as the margin's pass writes a carrier at the window's origin, restarted the
pose, and the catch-up was reported as a move without input. So was every
frame of a smooth scroll no input makes, where each reading lags one step.
#6688's trace journey hit the first: Playwright's hover scrolled the page
9px, a margin pass followed in the same task, and the row "moved without
input by (0, 9)px".

The anchor credit now first looks for the anchor's scroll travel over which
the judged node kept its offset from the anchor, reading each end at the
anchor's place then or before the reading that moved it (`laggedTravel`),
and falls back to the pose credit as before. A node that moved against its
anchor, or an anchor that moved in layout, finds no such travel and is
judged as before.

test_a_carried_row_keeps_its_anchor_s_lagging_scroll covers a step scroll
with a rewrite in the lag and a smooth scroll with a rewrite mid-glide: the
clean cases failed on the old watch and pass now; rows placed 5px off still
fail.
…aceCarriedRows relies on

margin-layout.js's header said remeasuring after a scroll writes the same
insets. That holds for a row outside a carrier; a carrier's inset and its
rows' margins are measured from the window, so they change with each scroll.
Writing them relative to the anchor instead broke
test_marks_stand_on_a_scaled_slide_in_every_engine[webkit_browser] 2 of 2:
after a scroll inside a scaled box WebKit resolves the anchor again only when
the inset's value changes, which the scroll-end pass's new value supplies.
@max-sixty
max-sixty merged commit 43ee75b into main Nov 22, 2026
6 checks passed
@max-sixty
max-sixty deleted the shift-watch-anchor-lag branch November 22, 2026 21:53
max-sixty added a commit that referenced this pull request Nov 23, 2026
…indow (#6688)

The page keeps no room for the floating panel: it lays out in the whole
window, the panel stands over it, and the user folds the panel with `.`
where it covers something. Until now the page kept a 72px band
(`--lf-foot-room`) across the window's whole width at the end of every
scroller and below every window-sized box, through about eleven rules
(body and part padding, `--lf-end-room` threaded through workspace
regions, tabs, panes and the file editor, sticky tracks, the trace
stage, a landing trim, the `under-panel` render refusal), and it kept
needing patches (#3394, #3619, #5969, #6555, #6671). Max asked whether
the page could know nothing about the panel; this is that change, which
he picked over keeping the band, on the decision page in his session.

What still counts the panel is Leaf's own placement: the root's landing
band still ends above the panel's band, and an inner scroller the page
can't carry, held in a full-window workspace or stuck, now ends its band
there too wherever the panel stands across the destination's columns
(`landingBand(scroller, across)`), in place of the band each pane kept
in its padding. The panel no longer writes the root's
`scroll-padding-bottom`, since a band across the whole window made a Tab
onto a stuck sidebar link beside the panel scroll the page 340px. A
Layout's end padding adds the safe area at the window's foot. Landings
also stop scrolling the page past how far it can still carry a scroller
(`pageCarry`, geometry.js), so a stuck tab side list's open item stays
in the window. Four faults the missing band exposed are fixed where they
live: an empty visual-review discussion now lays out where its comment
box would stand, so the box takes that seat only where the panel leaves
it in sight, rather than opening under the panel's row and jumping
between its two seats every 70ms; a comment box the user sees no longer
moves to a seat outside the window, which took the draft out of sight
when a review's window widened from a phone's width; and a file tree no
longer reveals a row the user pressed, which moved the row from under
the pointer before mouseup so the click opened nothing (main does this
too with a real mouse); and a Tab's landing above the panel, which waits
for the next frame, now runs first when a key comes before that frame,
so Enter on a link Tab left under the panel follows the link rather than
letting go of focus (`landing-scroll.js`).

To weigh: where content ends flush with the window's foot under the
panel's 540px, the row covers its last 44px until folded (4 of 27
examples at 1728×999, 1 on a phone; 1 on main), and Tab onto a control
there, as at the end of a long tab side list, leaves focus out of sight;
the browser's own reveals (find, a page field's caret) no longer stop
above the panel; and in a visual review that fills the window, the
comment box opens over the case's head, covering its help button, rather
than in its discussion.

Tests: the runs of every tier before last, on this branch
(https://github.com/max-sixty/leaf/actions/runs/45015279476) and on main
(https://github.com/max-sixty/leaf/actions/runs/45015281683), failed
four tests on the branch alone, each only some of the time, and each now
has a fix here: the Tab landing above; the aim sweep lets the page's
scroll carry a margin marker Leaf anchors to the page (`carriersOf`, now
on the check API); the stale-keys sweep shows a sample frame below the
window before reading, as a check does; and the file-pick test waits for
the page's scroll to start, which fails on main too. All four passed in
the last runs
(https://github.com/max-sixty/leaf/actions/runs/45044731101, branch;
https://github.com/max-sixty/leaf/actions/runs/45044712114, main). Those
failed two others on the branch alone on Linux: the drawing test, which
#6718 fixes and this branch now holds, and the trace journey, whose
`hover` scrolled the page 9px now that the root keeps no scroll padding,
which the shift watch misread (#6763, now on main, fixes the watch); the
journey now points without scrolling and passes 8 of 8 copies at 4× CPU
throttle. Seven more failed once each on the branch's macOS job alone,
as eight did on main's; rerun locally at 4× throttle, four fail on main
as well and three on neither. The latest runs, with #6718 in
(https://github.com/max-sixty/leaf/actions/runs/45073644131, branch;
https://github.com/max-sixty/leaf/actions/runs/45073646401, main),
failed nothing on Linux that main didn't. Six tests failed on the
branch's macOS job alone:
- two journeys whose announcements #6702 reworded on main, which fail on
main's Linux job too;
- a shift-watch teardown of the kind #6763 fixes;
- the removal test, which fails on main too at 4× CPU throttle;
- the pane pin and comment-box return tests, which passed all 12 local
copies, 6 on each tree, both plain and at 4× throttle.

Since those runs started, main gained #6720, #6739, #6756 and #6763,
which this branch now holds; in `seatFab` it keeps #6739's rule that a
seat is judged only as the box moves in, judged by this branch's rules.
Their new tests, with this branch's visual-review, card-growth and trace
tests, pass on that merge here. Locally the changed tests, the drawing
tests, `pnpm run test:runtime` and `pnpm run check:browser` pass on the
merge of today's main; the focus-ring sweep fails on `review-a-fix` on
main and here alike.

> _This was written by Claude Code on behalf of max-sixty_
leaf-agent added a commit that referenced this pull request Nov 23, 2026
…the row catches up (#6856)

The shift watch reported the root-tabs journey's margin marker as moving
without input when the page scrolled twice in a row. The marker's
carrier is anchored to the document, and Chrome moves an anchored box a
frame after its anchor scrolls, which #6763 taught the watch to credit.
That credit only applied when the anchor was read exactly at one of the
frames the watch compares.
`test_root_tabs_switch_views_without_moving_the_strip_and_follow_history`
calls `scrollIntoView` and then `scrollBy(-40)` from two scripts. The
marker caught up to the first scroll in the reading that already found
the document moved by the second, and that reading fell between the
compared frames. So the watch credited only the 582px the document had
settled at, against the marker's 622px, and reported the marker as
moving without input. The marker's painted position never jumped.

`laggedTravel` now also lets each end of a comparison pair the node with
the anchor as it stood one reading before the reading that last placed
the node, as well as one reading before the compared frame. The lag it
allows is still one reading, which #6763's description gives the reason
for.

Verification, on Linux under `leaf-dev suite flake --workers 4 --load
2`:

| Test | `main` (`39ee727dd`) | This branch |
|---|---|---|
|
`test_tabs.py::test_root_tabs_switch_views_without_moving_the_strip_and_follow_history`
| 5 of 24 copies error at teardown | 54 of 54 pass |
| new `test_a_carried_row_keeps_its_anchor_s_lagging_scroll[twice-]` |
24 of 24 fail (CPU throttle 1 and 6) | 24 of 24 pass |
| `…[twice-row]`, a row placed 5px off | | reported in 24 of 24 |

The 117 shift-watch cases matching `anchor or scroll or carried or
carry` pass, and the `lagging_scroll` cases pass at CPU throttle 1, 4
and 8. The `twice` case orders its second scroll explicitly: it posts
the scroll as a `user-blocking` task from the frame that carries the row
to the first scroll. That task runs ahead of the delivery of the frame's
painted shifts, so the watch's reading of that paint finds the words
moved by both scrolls and the row caught up only to the first. That is
the ordering the journey hits only under load.

#6744's other margin-marker teardown failures aren't this cause.
`test_render_application_boundary[Feed]` reproduces on `main` (1 of 24
on Linux), but its finding carries no scroll term at all. The trace
journey's finding names a different anchor (an `img`) and didn't
reproduce locally. Both stay open on the issue.

Part of #6744 — 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