Skip to content

Hear every script's scroll write, and take setScroll out of the package API - #6942

Merged
max-sixty merged 8 commits into
mainfrom
agent-ae22ff701aadc9f97
Nov 24, 2026
Merged

max-sixty merged 8 commits into
mainfrom
agent-ae22ff701aadc9f97

Conversation

@max-sixty

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

Copy link
Copy Markdown
Owner

One step of the package-interface redesign: Leaf hears a scroll write made with the browser's own call, so setScroll leaves the package API (177 names to 176) and packages write box.scrollTo(…). arrivals.js wraps scrollTo, scroll, scrollBy and the scrollTop and scrollLeft setters, on elements and the window, and records a move as setScroll does. Another vendor's component is heard too; before, its write read as the browser's own motion until scrollend.

To weigh:

  • The patch changes nothing a call does, so a write that moves nothing is still made. scrollMoves moves to the library, where three packages ask it, restating setScroll's skip at each caller.
  • Cost: about 2.5 µs more per moving write in both engines; leaf-dev bench reads a keystroke, wheel step, walk and Tab within noise.
  • A live sample loads the runtime, so it hears its own writes.
  • Lint refuses a scroll call that omits behavior.

Max approved the redesign and asked for small steps; he hasn't read this diff. A fresh agent reviewed it.

Tests: pre-commit, pnpm run check, 304 browser tests by node id, 18 holds-still cases, leaf-dev probe --base in both engines.

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

# Conflicts:
#	browser/AGENTS.md
#	browser/runtime/kernel-registry.json
#	packages/default/widgets/lf-tabs.js
#	packages/playwright/widgets/timeline.js
…te, a browser-driven scroll stays the browser's, lint reads every form of the call
leaf-agent
leaf-agent previously approved these changes Nov 24, 2026
@max-sixty
max-sixty merged commit 7ead512 into main Nov 24, 2026
8 of 9 checks passed
@max-sixty
max-sixty deleted the agent-ae22ff701aadc9f97 branch November 24, 2026 04:39
max-sixty added a commit that referenced this pull request Nov 24, 2026
One step of the package-interface redesign, after #6942: Leaf hears a
native `scrollIntoView` too. `arrivals.js` wraps it, and Chromium's
`scrollIntoViewIfNeeded`, and records each box the call moved at once,
as it records a `scrollTo`. A smooth reveal is still heard by its
events. Before, a reveal's boxes read as the browser's own motion from
their `scroll` events to `scrollend`.

To weigh:

- **A fix to #6942.** Chromium's scroll calls return a promise, which
the wrap on main drops; a heard call now returns what the browser's
returns.
- **Cost**: a reveal that moves its pane goes from 4 to 11 µs four boxes
deep and 4 to 33 µs thirty-four deep in Chromium; 4 to 12 and 2 to 14 in
Firefox.
- **Limits**: a target slotted into a closed shadow tree, and a focus's
or a fragment's reveal, are heard by events only.
- The package API keeps its 164 names.

Max approved the redesign and asked for small steps; he hasn't read this
diff. A fresh agent reviewed it.

Tests: pre-commit, `pnpm run check`, 146 browser tests by node id, 18
holds-still cases, `leaf-dev probe --base` in both engines.

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