Skip to content

test: check a sample script's own scrollIntoView by what it moves, not by its source text - #6987

Merged
max-sixty merged 2 commits into
mainfrom
agent-a0cea823db3df92dc
Nov 24, 2026
Merged

max-sixty merged 2 commits into
mainfrom
agent-a0cea823db3df92dc

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

test_sample_browser_boundary_contains_focus_scroll_and_parent_access has failed on main since #6951 (fb8b0cc1e7): it passes at that commit's parent and fails from it on. #6951 made Element.prototype.scrollIntoView Leaf's wrap around the browser's method in every Leaf document, a live sample's included, and the test asserted that the method's source text reads [native code].

What that assertion stood for still holds: a reveal a sample's script makes itself does what the browser's does. The test now makes that call and checks what it moves, which is the sample's own page and, through the sample's frame, the page around it. Leaf's own scrollIntoView leaves the page around the sample still, as the test already checked. focus keeps its source-text check, since nothing wraps it. No runtime code changes.

To weigh: the new check relies on the browser scrolling the host page for a reveal made inside a sandboxed frame, as Chromium and Firefox both do today. module-scroll-and-motion.md already says that Leaf's scrollIntoView, unlike the native one, stays inside a live sample.

The session running the package-interface redesign asked for this, after an agent found six browser tests failing on main. This is the only one of the six that a pull request of the redesign caused; the others trace to #6796, #6947 and #6009 and are left alone. Max hasn't read the diff.

Tests: the test by node id in Chromium, also under --cpu-throttle 8, and its body in Firefox with the fixture swapped by hand. It fails when the wrap drops the browser's call, and when the script's call is swapped for Leaf's contained one.

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

…t by its source text

`test_sample_browser_boundary_contains_focus_scroll_and_parent_access` has
failed on main since #6951 (fb8b0cc): it passes at that commit's parent
and fails from it on. #6951 changed what `Element.prototype.scrollIntoView`
is in every Leaf document, a live sample's included: Leaf's wrap around the
browser's method, which makes the call as written and records the boxes it
moved. The test asserted that the method's source text reads
`[native code]`, which no wrap passes.

What that assertion stood for still holds: a reveal a sample's script makes
itself does what the browser's does. The test now makes that call and
checks what it moves, which is the sample's own page and, through the
sample's frame, the page around it. Leaf's own `scrollIntoView` leaves the
page around the sample still, as the test already checked. `focus` keeps
its source-text check, since nothing wraps it.

No runtime code changes. The rewritten test passes in Chromium, and its
body passes in Firefox with the fixture swapped by hand. It fails when the
wrap drops the browser's call, and when the script's call is swapped for
Leaf's contained one.
@max-sixty
max-sixty merged commit a0d859a into main Nov 24, 2026
6 checks passed
@max-sixty
max-sixty deleted the agent-a0cea823db3df92dc branch November 24, 2026 08:20
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