Repository navigation
Upgrade Python Playwright to 1.64 while preserving scroll and input behavior - #3772
Conversation
Chrome 156 emits scrollend for layout moves and can reveal the caret by scrolling the page behind a fixed response. Distinguish layout moves from user scrolls, restore the page place during floating response edits, and adapt browser gestures to avoid Playwright's preparatory scroll on visible fixed controls. Bump both Python and Node Playwright requirements and rebuild the kernel. The existing reading-place, editor, touch, frame-watch, and feature-gallery journeys pass under 1.64. Main's concurrent swap-watch repair resolves the offscreen frame drain without a second workaround here. Closes #3361
Format the runtime and browser tests as the CI hooks require. Schedule the floating editor's input cleanup through Leaf's next-frame queue so presentation settling counts it, then rebuild the committed kernel.
|
The red CI run on The affected pre-commit hooks, |
# Conflicts: # dist/kernel/runtime/bundle-annotation-overlay~index.js # dist/kernel/runtime/bundle-presence.js # pnpm-lock.yaml
Update the locked `websockets` dependency from 17.2 to 17.3. `uv lock --check` passes. The Playwright 1.64 upgrade, with its browser behavior changes, is covered by #3772. --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: leaf-agent <[email protected]>
leaf-agent
left a comment
There was a problem hiding this comment.
The new repeated branch treats two scroll events as a reader choice even when layoutMoved says that layout moved the box. If a streaming widget grows above the viewport in two steps before scrollend, anchoring can produce two scroll events without any reader input; this branch then calls chooseScroll. version.js uses that choice to rank a new reading place, so a later layout change can restore the position that layout produced instead of the reader's place. The same classifier also suppresses a single script or browser navigation scroll when the extent changes. The number of scroll events does not establish who moved the box; this needs a way to distinguish the gesture from the layout movement while preserving script and native navigation as choices. This is a code-path finding; I could not run its browser case locally because the Playwright 1.64 headless shell is absent.
Keep lit-html 3.3.0: 3.3.3 still leaves a marker for every removed repeat row, which a focused runtime test now catches. Keep Playwright 1.63.0 while PR #3772 carries its runtime changes. Update Pele and Pierre build seams and regenerate their shipped bundles for the other 24 updates.
Updates 24 JavaScript dependencies and rebuilds the browser assets shipped with Leaf. The changed Pele and Pierre build adapters match their new published modules. A frozen install, `pnpm run check`, and the repeat-row regression test pass on the repaired head. `lit-html` stays at 3.3.0 because 3.3.3 still accumulates markers when `repeat` rows are removed; #3783 tracks its eventual upgrade. Playwright stays at 1.63.0 because #3772 carries the 1.64 runtime fixes and should own that version change. A base/candidate `code-comparison` startup probe recorded 50 requests through presentation on each arm. The candidate delivered 1,357 more bytes through that phase, with no additional requests. --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: leaf-agent <[email protected]>
# Conflicts: # pnpm-lock.yaml
# Conflicts: # dist/kernel/runtime/bundle-annotation-overlay.js # tests/browser/margin/test_pins.py
|
surely you need to install the correct version of playwright?? |
|
Yes. I installed the Playwright 1.64 headless shell pinned by this PR; my earlier local-test limitation was avoidable. With that browser, the focused reading-place tests for script scrolling during content growth and keyboard paging, plus the floating response editor test, pass locally ( I also checked the separate scroll-classification finding in Chromium 156. In a direct browser probe, growing content above a scroller by 40px and scrolling it another 100px by script in the same task moved its offset from 450px to 590px, with one |
# Conflicts: # tests/browser/threads/test_media.py
# Conflicts: # dist/kernel/runtime/bundle-annotation-overlay.js # dist/kernel/runtime/bundle-reading-regions.js
# Conflicts: # dist/kernel/kernel.json
# Conflicts: # dist/kernel/runtime/bundle-annotation-overlay.js # dist/kernel/runtime/bundle-reading-regions.js
# Conflicts: # tests/render_harness.py
# Conflicts: # dist/kernel/kernel.json # dist/kernel/runtime/bundle-annotation-overlay.js
) Update nine Node dependencies: Claude Agent SDK to 0.3.309, Workers types to 5.20261023.1, pi-ai to 1.4.0, SnapDOM to 3.3.7, Pele to 1.9.0, Playwright to 1.64.1, Vite to 8.3.5, Wrangler to 4.152.0, and Codex to 0.164.0. Keep `lit-html` at 3.3.0; #3783 tracks the deferred upgrade. Refresh the SnapDOM warning-suppression and Pele literal-label build adaptations, and commit the rebuilt bundles and license notices. These preserve capture behavior and literal unsupported tags in diagram labels. Validation: `pnpm run build:browser`, `pnpm run check`, and the final `pnpm run check:browser` passed. The capture drag test passed both cases, and a direct check of the final Pele bundle preserved literal `<img>` text and bold formatting. CI on the repaired head remains for the queued review. The Node Playwright update overlaps #3772, which also upgrades Python Playwright and carries browser runtime repairs. --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: leaf-agent <[email protected]>
# Conflicts: # dist/kernel/kernel.json # dist/kernel/runtime/bundle-annotation-overlay.js # dist/kernel/runtime/bundle-reading-regions.js # package.json # pnpm-lock.yaml
# Conflicts: # dist/kernel/kernel.json # dist/kernel/runtime/bundle-annotation-overlay.js
# Conflicts: # browser/runtime/annotation-overlay/composing/floating-response.js # dist/kernel/kernel.json # dist/kernel/runtime/bundle-reading-regions.js
# Conflicts: # dist/kernel/runtime/bundle-annotation-overlay.js # dist/kernel/runtime/bundle-reading-regions.js
# Conflicts: # dist/kernel/runtime/bundle-annotation-overlay.js
# Conflicts: # dist/kernel/runtime/bundle-annotation-overlay.js # dist/kernel/runtime/bundle-content-layout.js
|
Resolved the generated-kernel conflict by merging main and rebuilding; pushed The confirmed scroll-classification finding recorded above remains unresolved, so this conflict repair does not land the PR. |
# Conflicts: # dist/kernel/kernel.json
|
Resolved the generated-kernel conflict by merging main and rebuilding; pushed The scroll-classification finding recorded above remains unresolved, so this conflict repair does not land the PR. |
# Conflicts: # dist/kernel/kernel.json # dist/kernel/runtime/bundle-annotation-overlay.js # dist/kernel/runtime/bundle-content-layout.js
Review found that the scroll-end classifier reads a script or browser travel scroll as layout's when the scroll range changes in the same frame, and questioned treating a sequence of several scroll events as a choice. Find-in-page that opens a `hidden="until-found"` fold now counts as the reader's choice: the browser fires `beforematch` before it opens the fold, and the next scroll end within two frames counts as a choice. In Firefox, whose `window.find` opens folds as its find bar does, a width change after such a find used to move the found words 1,300px away; they now stay put. The new test fails without the mark. The several-events rule stays. Chromium 156, Firefox 157 and WebKit 27 each end every anchoring or clamp move as a sequence of its own, even when the moves come in consecutive frames, so layout alone never produces a sequence of several scroll events. Firefox also sends a second `scrollend` after a layout move without scrolling. That end left the box where the last one did, so it now counts as no choice. `ended` replaces `lastTop` and starts unset for a box first watched mid-scroll.
…o fix/playwright-164-behavior
|
On the scroll-classification finding, now addressed in 32c473f. Every measurement below used Playwright's own builds, and the Playwright 1.64 headless shell is now installed locally.
|
# Conflicts: # dist/kernel/runtime/bundle-annotation-overlay.js
The coordinate-based press helper introduced by #3772 sent input through its document argument, but a Playwright `Frame` has no mouse or touchscreen. The helper now uses the frame's owning page for input while keeping the locator scoped to the child document. Bounding boxes already use main-viewport coordinates, preserving the visible-control route that avoids Chromium 156's preparatory scrolling. Both affected inspection tests reproduce the `AttributeError` before the change and pass after it, verifying child-document arrival and the manual diagnostics-copy route. The selected top-level inspection and small-screen map mouse/touch cases also pass: 5 cases total. Ruff and Python compilation pass. Closes #4669 — automated triage Co-authored-by: leaf-agent <[email protected]>
…4694) The margin test compared marker navigation with a scroll position recorded before editing a reply. On current main it fails with 13px versus 0px, but instrumenting the journey shows the page already at 13px before Home or ArrowDown. Opening the card still passes its original unchanged-scroll assertion. Record the marker walk's baseline after entering the margin, then assert that both Home and ArrowDown preserve it. The original card-opening assertion and reply, draft, reopen, and focus checks remain intact; product behavior is unchanged. This keeps the test aligned with the separate opening and navigation guarantees while allowing the intervening editor interactions to reveal their caret, behavior discussed in #3772. Verification: the reported test failed before the change and passed after it at normal speed. It also passed with Chromium slowed sixfold; Ruff lint and formatting checks pass. Closes #4672 — automated triage Co-authored-by: leaf-agent <[email protected]>
Hidden bounded logs now grow without forcing their skipped subtree to be styled or measured. Scroll-layout tracking keeps observing hidden children but defers their measurements until reveal; hidden scroll events do not become reading choices, and reading-region classification leaves concealed bodies alone. Reopening History still puts both logs at their newest entries. The existing hidden-log regression reproduced the CI run's 92 reads before the fix. Temporary stack capture identified `scrolling.js`'s child observer and scroll-end listener, `bounds.js`'s scroll listener, and `reading-regions.js`'s scroll classification. The layout observer added in #3772 remains responsible for distinguishing native layout clamps from reader choices; its first visible reading refreshes the baseline after a hidden interval. Validation: seven focused browser tests passed, including hidden-log growth/reopening, disclosure sampling, feed rebuilding, revision reading restoration, concealed landmarks, and both wheel/clamp variants. `pnpm run check` passed, including runtime tests and browser/Worker type checks. The kernel is rebuilt. A base/candidate `code-comparison` startup probe reached upgrade and server-state presentation with 40 requests on each arm, 247 additional code bytes, identical recorded startup shifts, and no console errors. The visibility checks prevent forced hidden layout and need to run before measurements. Closes #1987 — automated triage Co-authored-by: leaf-agent <[email protected]>
An instant landing on a saved trace element was missing the explicit scroll-choice marker used by smooth landings. When opening the tree also changed its layout, the scroll classifier introduced in #3772 treated that jump as layout's, so continuity restored the tree's older reading over the selected row. The shared landing function now marks both motions before scrolling. With reduced motion, the Saved element Moment keeps its row visible inside the tree and the page; ordinary motion and checkpoint reopening retain their behavior. The existing reduced-motion regression fails on the base with the row at 784–840px outside a 228–408px band, and passes after this change. Both motion cases and checkpoint reopening pass, as do pane continuity in Chromium/WebKit, Firefox's native hidden-fold search, all 712 runtime tests, and `pnpm run check`. Base/candidate startup probes load 40 requests (36 code requests) through upgrade and server-state presentation, with 28 fewer code bytes in the candidate. This is a partial repair. `test_trace_tree_opened_by_the_browser_keeps_its_match` still fails on the base and candidate: it opens the disclosure and scrolls through a script in the same task. The classifier deliberately treats a single script jump coinciding with changed layout as layout's. That simulation does not establish actual browser-find behavior; Chromium and Firefox `window.find` attempts did not open this trace disclosure. The remaining step is to reproduce through native find UI and establish the events it delivers before changing that classification. A full Chromium launch under Xvfb here fails before opening a page because its process-singleton socket is unavailable (`Address family not supported by protocol`); that check needs an environment supporting full Chromium's native window path. #4747 stays open for that work. Refs #4747 — automated triage Co-authored-by: leaf-agent <[email protected]>
Upgrade Python Playwright to 1.64, which uses the same Chromium 156 as the Node Playwright main already runs (#4204), and keep Leaf's reading position and editor behavior under that browser.
Chromium 156 now sends
scrollendafter it anchors or clamps a box, as Firefox 157 and WebKit 27 already do. Soscrolling.jsno longer reads every scroll end as the reader's choice. A single move counts as layout's if the box's extent changed while it moved. A sequence of several scroll events still counts as someone's glide: all three engines end each anchoring or clamp move as a sequence of its own, even when the moves come in consecutive frames. Find-in-page that opens ahidden="until-found"fold firesbeforematchfirst, so the scroll that follows counts as the reader's choice. An end that leaves the box where the last one did counts as no choice; Firefox sends one after layout moves. Chromium 156 can also scroll the page behind a fixed response editor while revealing its caret. The runtime restores the page's place in the editor's input task. Browser tests press visible fixed controls without Playwright's preparatory scroll.The focused reading-place, pane, editor, touch, offscreen-frame and trace-import tests pass under 1.64. A new Firefox test finds words in a closed fold and then changes the window's width. It fails without the
beforematchmark: the found words end up 1,300px away.pnpm run checkpasses. An earlier base/candidate startup probe ofcode-comparisonshowed 51 requests on each arm through presentation, and 3,322 more bytes delivered by the candidate for the runtime repair. The committed kernel is rebuilt on the merged tree.Two failures don't come from this change:
tests/browser/threads/test_media.py::test_touch_capture_attaches_on_lift_and_a_tap_or_cancel_attaches_nothingalso fails on main.test_the_feature_gallery_exercises_its_core_journeysfailed 3 of 5 local runs under 1.64 on a loaded host. It failed once as a shift-watch finding in a sample and twice as a pin-in-view assertion. It passed 2 of 2 runs under 1.63, and it fails the same way without this branch's scroll change.Closes #3361