Repository navigation
test: check a sample script's own scrollIntoView by what it moves, not by its source text - #6987
Merged
Merged
Conversation
…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.
leaf-agent
approved these changes
Nov 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
test_sample_browser_boundary_contains_focus_scroll_and_parent_accesshas failed on main since #6951 (fb8b0cc1e7): it passes at that commit's parent and fails from it on. #6951 madeElement.prototype.scrollIntoViewLeaf'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
scrollIntoViewleaves the page around the sample still, as the test already checked.focuskeeps 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.mdalready says that Leaf'sscrollIntoView, 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.