Skip to content

Let a page wider than the window scroll sideways to its far side - #5120

Merged
max-sixty merged 2 commits into
mainfrom
agent-aa32ada71b1ee900c
Nov 3, 2026
Merged

max-sixty merged 2 commits into
mainfrom
agent-aa32ada71b1ee900c

Conversation

@max-sixty

@max-sixty max-sixty commented Nov 3, 2026 •

Copy link
Copy Markdown
Owner

Since #5049, a page that takes no theme keeps the browser's own tables and code blocks, so one wider than the window no longer scrolls inside its own box. Leaf's root rule html[data-lf-live] { overflow-x: hidden } (browser/base.css) then stopped the page itself scrolling sideways, and the far side couldn't be reached at all. This deletes the rule. A page wider than the window now pans sideways, as on the open web, and page check --render still refuses it (page-scrolls), so an agent still fixes the overflow before handing the page over.

The rule came in when the root became Leaf's document scroller (26feec8), as what was left of the earlier html { overflow: hidden } from when body scrolled, and #439 carried it into the render-blocking theme. Neither commit gives a reason for the sideways clip.

What changed

  • browser/base.css: the rule is gone. The root's comment now says the root scrolls on both axes and that the gate refuses a page wider than the window.
  • Five comments gave the clip as their reason and now give the sideways scroll and the gate's refusal: the body's overflow-wrap and the media max-width rules (base.css), the pin count's left placement (annotation-theme.css), the rail carrier's note on the document's sideways scroll (margin-layout.js), and the reading face's header (reading.css). The rules themselves stay, since each still keeps content inside its box. The margin-layout.js comment moves the kernel's input hash (dist/kernel/kernel.json).
  • tests/journeys/test_plain_pages.py: the dashboard's clipped-out <table> pin no longer occurs, because the root no longer clips the table, so it goes. The obstacle is renamed sideways-refusal and names only the gate's refusal. page-scrolls and past-column stay pinned.
  • tests/browser/test_render_gate.py: test_a_page_wider_than_the_window_scrolls_sideways_to_its_far_side serves a no-theme page holding a nowrap table at 390px and wheels over the table until its last column is in the window. With the rule restored, it fails: the wheel never moves the page.

Behaviour that changed

  • A page wider than the window scrolls sideways by wheel and the arrow keys (measured below). Touch and trackpad panning use the same native root scroll and weren't driven. Where the platform draws classic scrollbars, such a page should show a horizontal bar at the window's foot; that wasn't captured.
  • The render gate now reads the root as a scroller on both axes. Content past the window's right edge is reported through page-scrolls, and no longer also as clipped-out by the root (the dashboard pin above) or, by the same reading of the root's overflow in reachability.js, as clipped-control. Content carried off the leading edge, which no scroll reaches, is still clipped-out (test_the_render_gate_tells_what_a_column_loses_from_what_stands_beside_it passes).

Measured

A no-theme page with a wide table. The plain dashboard fixture, initialized --no-theme --no-packages and served by bin/leaf server start under a fresh state home, read by leaf-dev probe with a journey that brings the table into the window, wheels 1000px sideways over it, then returns and presses ArrowRight twelve times. At 390×844 the last column stands at 419–563px and the page overflows by 173px in both versions.

engine before: wheel / arrows after: wheel / arrows
Chromium 0px / 0px 173px / 173px
Firefox 0px / 0px 173px / 173px
WebKit 0px / 0px 173px / 0px

After a 173px scroll the last column stands at 246–390px, whole in the window. WebKit under Playwright doesn't scroll for synthetic arrow keys at all: ArrowUp doesn't move it vertically either, in either version. At 1440×900 nothing overflows in either version and nothing moves.

Leaf's own chrome. scrollWidth counts overflow under overflow-x: hidden too, so the page's sideways overflow (the gate's rootOverflow) reads the same in both versions; any state above 0 would be one the user can now pan sideways. Across 48 leaf-dev stills states, each driven by its stills driver on a fresh page — the floating panel and the leaf's menu, margin cards and their replies, the thread view on a phone, Threads, the more menu, page search, the page map, the contents, capture, the phone margin, touch and narrow variants, and pages whose own tables and diagrams scroll sideways — the overflow was 0 in every state that completed: 47 in Chromium, 45 in Firefox and 46 in WebKit. plan-card-beside fails in its driver in all three engines, and table-scrolled-phone in Firefox; both fail the same way on main (checked in Chromium and Firefox respectively). live-sample-embedded-phone was read in Chromium only, since the feature gallery hung Firefox's run. Every margin row of review-a-plan, pointed at so it unfolds, at 20 window widths from 390 to 1640px (pins up to 900px, the rail from 1000px), also gave 0 in Chromium and Firefox.

Stills. leaf-dev stills against the merge base for 16 of those states: in every one, the only computed-style difference is html overflow-x: hidden -> auto. Pixels are unchanged except in two states. margin-gallery-phone differed by an overlay scrollbar's fade and was unchanged on a rerun. plan-thread-phone differs on both runs: after the stills driver presses the stop thread's marker on a phone, the page stands 421px higher in one version than the other.

That scroll comes from Playwright, not from the press. I ran the driver's sequence 25 times on main (3cbb347) and 25 on this branch, interleaved in one Chromium with the arm order alternating each round, alternating motion settings, and the host's load at 6–7. The page scrolled in 3 of 25 runs on main (12%) and 8 of 25 on the branch (32%), two-sided Fisher exact p = 0.17. In all 11 runs that scrolled, the page had moved before pointerdown reached it. Playwright's click scrolls its target into view first, and in each of those runs it read the marker's box at top 2470px, where the marker stood before the driver's scroll. The marker was painted at 281px, so Playwright scrolled 421px toward the stale box. A real tap does no scroll-into-view, and Leaf focuses the marker with preventScroll, so a user's tap scrolls the page in neither version.

The stale box itself is already on main. In the same sequence without the press, the marker's box and elementFromPoint at the place it is painted lagged the scroll in 6 of 12 runs on main and 4 of 12 on the branch (p = 0.68), for 28–30 frames either way. During that half second, a press where the marker is painted doesn't reach it; whether the paint lags too wasn't checked. The rate at which Playwright's check lands in the lag does depend on the version in this harness: under reduced motion the branch scrolled in 11 of 32 click runs and main in none (p = 0.0003), while under normal motion it was 3 of 13 each. A test that clicks a margin marker on a phone right after an instant scroll may therefore meet Playwright's scroll more often on this branch. The lag is the defect to fix, and it belongs to its own change.

Not measured: frames during motion, and a WebKit keyboard route.

Checks

  • The new test passes, and fails with the rule restored.
  • tests/browser/test_render_gate.py -k over the no-theme breakout table, the root scrollport's sideways room, page overflow beside an authored scroller, the page edge and the too-wide table: 6 passed.
  • tests/journeys/test_plain_pages.py: 9 passed, 3 xfailed with the updated pins. In tests/journeys/test_render_gate.py, the page that scrolls sideways only between viewports, what a column loses, and a box its container clips away: passed.
  • pnpm run check, which includes the runtime's 750 tests and the kernel comparison: passed. uv run pre-commit run --files on the changed files: passed.

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

Delete the live root's `overflow-x: hidden` (base.css). Since #5049 a page
that takes no theme keeps the browser's tables and code blocks, and one wider
than the window could not be reached: the root clipped it and the wheel moved
the page 0px. The page now pans sideways as on the open web, and
`page check --render` still refuses it (`page-scrolls`).

The comments that gave the clip as their reason now give the sideways scroll
and the gate's refusal. The plain dashboard's `clipped-out` pin lifts, since
the root no longer clips the table, and its obstacle is now the gate's
refusal alone. A new browser test wheels a no-theme page's wide table to its
last column at 390px.
@max-sixty
max-sixty merged commit f69c5e9 into main Nov 3, 2026
4 checks passed
@max-sixty
max-sixty deleted the agent-aa32ada71b1ee900c branch November 3, 2026 05:56
max-sixty added a commit that referenced this pull request Nov 3, 2026
…lls (#5225)

A margin row quoting a passage now stands in the root lane wherever the
page's own scroll is the only thing moving its words, as rows on whole
elements already did, so a script finds the row where it is drawn in the
same task as a scroll. Every row is also placed again once a CSS
transition or animation that moved its words or its element ends.

**What this buys, and what it doesn't.** Real users saw nothing wrong on
main. A real tap or click on the marker three frames after a scroll
reached it in 12 of 12 runs, and an independent review's recordings show
the painted marker within ±1 px of its words on both arms, smooth scroll
included. The gain is for scripts, which on main read the row at its old
place until the next frame rendered. That includes Playwright's actions:
#5120's reviewer saw a tap aimed in that window scroll to the old place
and miss. It also covers probes and the suite, and it leaves fewer
`position: fixed` carriers on a page. The transition re-placement is a
gain for users. A row on an element whose transition moved it 160 px
stayed 160 px off on main until some unrelated pass ran, and so did a
quoted row in Firefox; both now stand on their words once the transition
ends.

**Cause.** #3091 put every quoted row in a carrier anchored to its
words, so the row would follow words that a box inside the target
scrolls. It did that for every passage, including words that only the
document scrolls. A carrier takes up a script's scroll only as the next
frame renders: css-anchor-position-1 updates anchor positions once a
frame. Chromium also caches an `elementFromPoint` answer given in that
window, for 23 to 28 more frames.

**Change.** `carrierAnchor` takes the passage's words as the row's
subject, by the rule rows on elements follow:

- A row whose words sit in a pane, an inner scroller, or inside a sticky
or fixed box keeps a carrier anchored to its words.
- A row under a sticky header the page declares stands in a carrier
anchored to the document's first box, as a row on an element does. Pages
with such a header, an `lf-tabs` strip for instance, keep every row in a
carrier, and this change doesn't reach them.
- Every other row stands in the root lane.

Rows stand where they stood. On `review-a-plan` at 1440 × 900 and 390 ×
844, and `ship-review` and `release-notes` at 1440 × 900, every row's
rectangle matches main's.

The re-check that already runs, once a frame, when a box inside the page
scrolls and when a transition or animation ends asked only whether each
row under that box still shows. It now also places a row again when its
subject, the words or element it stands by, has moved from where the
last pass stood the row by it (`subjectMoved`). The re-check measures
that against whatever carries the row, so it covers rows in carriers
too.

**A trade-off Max may reverse.** In Chromium and WebKit, a carrier
anchored to the words carried a quoted row along while a transform moved
them. In the root lane the row trails a running transform and lands at
its end, as rows on elements always have. The decision and the rejected
alternative are recorded in `carrierAnchor`'s comment. Two cases stay
off, as rows on elements already are on both arms:

- A scroll-driven animation fires no end event. Its quoted row ends 39
px off in Chromium and WebKit until the next pass, where main left it 16
px off.
- A Web Animations motion (`element.animate`) fires no end event either,
so `subjectMoved` never sees it. In the review, with a held animation in
Chromium, main's quoted row followed its words and this branch's stays
160 px off until the next pass, as element rows already do on both arms.
`lf-deck` flights land right on both arms only because the deck's
put-away step writes a style at the end of the flight, which brings a
pass. A quoted row and an element row on the card Back brings in
measured the same on both arms, during the flight and at rest, in all
three engines.

`subjectMoved` also runs in the existing once-a-frame reading of a
scroll inside a box, not only when a transition ends. In Firefox, inside
a scaled box, that changes what a smooth scroll does. Firefox carries an
anchored row by the scroll's layout distance, not the distance the words
move on screen. On main the row drifted up to 48 px and was placed once
at `scrollend`. Now the re-check finds the words leaving it and places
it again during the scroll: 26 passes over 72 frames, the row within 7
px of its words, and no frame over 15 ms on a four-row page. The
`scrollend` pass stays, since WebKit is 24 px off without it. By the
code's reading, WebKit's measured anchor moves with the words, so its
rows still drift until `scrollend`; that is not measured. The stir
comment, the `css-anchors.js` header and the scaled-scroll entry in
`notes/browser-support.md` now say so.

**Evidence.** The scroll measure loads `review-a-plan` at 390 × 844 with
touch and reduced motion, and scrolls the marker to a third of the
window. It then counts the frames until the marker's box, and a hit test
at one point where the marker is drawn, have caught up. 0 means they
were right in the task that scrolled. Five runs per cell, main and this
branch back to back:

| engine | main: box | main: hit test | this branch |
| --- | --- | --- | --- |
| Chromium 156.0.8078.4 | 2 frames late | 23–28 frames late | 0 for both
|
| Firefox 157 | 2 | 2 | 0 for both |
| WebKit 27.2 | 1 | 0 | 0 for both |

The transform measure, at 1440 × 900, is the offset of each row from
where a fresh pass stands it, at rest after a 160 px transition. It uses
the reviewer's page with its quoted row (`moving`) and element row
(`mover`), run with `leaf-dev probe --journey --base=origin/main`:

| engine | main: quoted | main: element | this branch: quoted | this
branch: element |
| --- | --- | --- | --- | --- |
| Chromium | 0 | 160 | 0 | 0 |
| Firefox | 160 | 160 | 0 | 0 |
| WebKit | 0 | 160 | 0 | 0 |

During the 500 ms transition, the quoted row in Chromium trailed by up
to 160 px on this branch, where main kept it on the words; WebKit and
Firefox trailed on both arms.

**Tests.**

-
`test_a_passage_s_row_moves_with_the_page_s_scroll_in_the_task_that_scrolls`
scrolls a quoted row into view and reads, in the same task, its offset
from its words and whether `elementFromPoint` where it is drawn finds
it, for a pin at 390 px and a rail row at 1440 px. On main both cases
fail: the box is still 3727 px and 1374 px from its words.
- `test_rows_stand_by_words_a_transition_moved_once_it_ends` moves a box
160 px by a CSS transition and reads, two frames after `transitionend`,
where the quoted row and the element row stand. On main the element row
fails, 160 px off. Without `subjectMoved` both fail.
- `test_the_rail_tab_stop_follows_a_carried_row_back_into_view` needs a
row that stands in a carrier. ship-review's first row no longer does, so
the test now builds one on a line a box scrolls sideways; the behaviour
it protects is unchanged.
- `notes/browser-support.md` records Chromium's cached
`elementFromPoint` answer, with the evidence that real input isn't
affected, under "A cached `elementFromPoint` answer in Chromium". Rows
in carriers keep it.

Ran:

- the three tests above against main, the branch without `subjectMoved`,
and this branch;
- 53 tests in `tests/browser/margin/test_scrollers.py` selected for
carriers, panes, passages, code blocks, scaled and widened boxes, sticky
cuts and transitions;
- 13 tests asserting that a scroll writes nothing or reflows nothing;
- 26 more on quoted rows, cards on shipped examples, comment marks and
the smoke tests;
- `pnpm run test:runtime` (753 passed), `pnpm run build:browser`, `pnpm
run check:browser`, and pre-commit on the changed files.

Not verified: the iOS simulator; and the journeys tier and corpus render
gate, which landing runs.

> _This was written by Claude Code on behalf of max-sixty_

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
leaf-agent added a commit that referenced this pull request Nov 5, 2026
…dow's right edge (#5574)

`test_an_obligation_spanning_its_block_is_a_breakout` has failed on main
since #5120 because it still expects `clipped-out` on `<div id=sized>`.
#5120 deleted the root's `overflow-x: hidden` so a page wider than the
window scrolls sideways, and its description says content past the
window's right edge is now reported through `page-scrolls`, no longer
also as `clipped-out` by the root. `#sized` is `width: calc(100% +
600px)`, so it reaches past the right edge only. That finding went away
by design. `#bare` and `#tinted` use negative margins on both sides, so
they still reach off the leading edge, which no scroll reaches, and keep
`clipped-out`. All three still report `past-column`.

This PR drops the stale pin and says in the docstring which boxes are
clipped and why. It changes no code and no behavior beyond what #5120
intended.

Verified with `uv run pytest --run-main` on that test: it failed on
`990cc5f4a`, the same diff as the issue's, and passes with this change.
With `browser/base.css` restored to `f69c5e9fe^` (the rule back), the
updated test fails again, which ties the dropped finding to that rule.

Closes #5489 — 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