Context
test/playwright/e2e/grid/HeaderCellRectSync.spec.mjs "repeated back-and-forth drag keeps every header rect locked to its cell rect" flakes e2e-engine (3/4) (#19967, job 119372987209). Locally the real arm failed 5/96 under 6 workers; a probe replaying it failed 3/144.
- Always pass 2: in every failing trace, pass 1 drags and drops normally, and pass 2's press never arms. The traces' pointer coordinates show why: pass 1 pressed the dragged header at x=1724, pass 2 at x=2136 / 2081, outside the 1920 px viewport. After pass 1's drop the grid had lost its 412 px horizontal scroll.
- The mechanism, from the arm's own scroll trace: one header-toolbar scroll event fires 36–69 ms after the release, with the toolbar at 0 while the body's
--grid-scroll-left still reads 412. At the failure, toolbar, body var and scrollbar all read 0.
The Problem
The drop's layout restore clamps the header toolbar's native scrollLeft to 0 for a moment. That is known: processDragEnd()'s own comment in src/draggable/grid/header/toolbar/SortZone.mjs describes it and re-applies the scroll truth afterwards. Since #19957 (#19955), GridHorizontalScrollSync#onHeaderScroll routes every native header scroll that is not its own echo into the scrollbar. So when the clamp's scroll event lands, the clamped 0 becomes the grid's scroll truth. The scrollbar, body and owner.scrollLeft follow it, and the re-apply then has nothing left to restore.
User-visible: reorder a column while the grid is scrolled right, and the grid can jump back to its left edge. Before #19957, the same late clamp offset the header alone, which is the bug class this arm was written for, and the re-apply hid it unless the clamp landed after it.
The Architectural Reality
src/main/addon/GridHorizontalScrollSync.mjs onHeaderScroll() copies the header's scrollLeft into the scrollbar whenever it differs from registration.headerScrollLeft. It does not ask whether the header could hold the scrollbar's position at all.
SortZone#processDragEnd() re-applies owner.scrollLeft to the toolbar after await me.timeout(30), when owner.scrollLeft > 0. The toolbar's own restore update (owner.updateDepth = 2; owner.update()) is not awaited, so under load it can land after the re-apply.
- Design authority: that comment ("restoring the items out of
position: absolute passes through a reflow frame where the owner toolbar has no scrollable overflow, so the browser clamps the toolbar element's native scrollLeft to 0 … Re-apply the worker-side scroll truth to the toolbar element once the restore has settled"), and #19955's intent: a header scrolled into view by focus moves the grid. Neither intends a layout clamp to move the grid.
The Fix
onHeaderScroll() routes a header scroll only while the header can hold the scrollbar's position, scrollerNode.scrollLeft <= headerNode.scrollWidth - headerNode.clientWidth + 1. A header that cannot reach it was clamped by layout, not scrolled.
processDragEnd() re-applies the truth once the toolbar's pending updates have landed (await owner.promiseUpdate()) instead of after a fixed 30 ms.
Acceptance Criteria
Out of Scope
- Why the restore clamps at all. Keeping the drag's extent sentinel until the items are back in flow could remove the clamp at its source; that needs its own measurement.
Related
#19955 · #19957 · #19967 · #12955
Live latest-open sweep: checked the latest 20 open issues at 2026-10-21T22:46:10Z; no equivalent (#19919, #19515 and #19136 touch drag or grid otherwise).
A2A sweep: the last 8 messages, all read-states; no overlapping claim.
MC sweep: one query on the symptom ("grid jumps back to the left after dropping a column, header toolbar scroll clamped after drag drop"), 4 results. They are older header-scroll architecture notes; none rules on this.
Own-assignment sweep: 7 open; #19973 is another mechanism.
Origin Session ID: 17bb8277-9137-4774-9a4d-7d98db9779a6
Retrieval Hint: "column drop header scroll clamp resets grid scroll, GridHorizontalScrollSync onHeaderScroll routes clamp, HeaderCellRectSync pass 2 off-screen"
Context
test/playwright/e2e/grid/HeaderCellRectSync.spec.mjs"repeated back-and-forth drag keeps every header rect locked to its cell rect" flakese2e-engine (3/4)(#19967, job 119372987209). Locally the real arm failed 5/96 under 6 workers; a probe replaying it failed 3/144.--grid-scroll-leftstill reads 412. At the failure, toolbar, body var and scrollbar all read 0.The Problem
The drop's layout restore clamps the header toolbar's native
scrollLeftto 0 for a moment. That is known:processDragEnd()'s own comment insrc/draggable/grid/header/toolbar/SortZone.mjsdescribes it and re-applies the scroll truth afterwards. Since#19957(#19955),GridHorizontalScrollSync#onHeaderScrollroutes every native header scroll that is not its own echo into the scrollbar. So when the clamp's scroll event lands, the clamped 0 becomes the grid's scroll truth. The scrollbar, body andowner.scrollLeftfollow it, and the re-apply then has nothing left to restore.User-visible: reorder a column while the grid is scrolled right, and the grid can jump back to its left edge. Before
#19957, the same late clamp offset the header alone, which is the bug class this arm was written for, and the re-apply hid it unless the clamp landed after it.The Architectural Reality
src/main/addon/GridHorizontalScrollSync.mjsonHeaderScroll()copies the header'sscrollLeftinto the scrollbar whenever it differs fromregistration.headerScrollLeft. It does not ask whether the header could hold the scrollbar's position at all.SortZone#processDragEnd()re-appliesowner.scrollLeftto the toolbar afterawait me.timeout(30), whenowner.scrollLeft > 0. The toolbar's own restore update (owner.updateDepth = 2; owner.update()) is not awaited, so under load it can land after the re-apply.position: absolutepasses through a reflow frame where the owner toolbar has no scrollable overflow, so the browser clamps the toolbar element's native scrollLeft to 0 … Re-apply the worker-side scroll truth to the toolbar element once the restore has settled"), and#19955's intent: a header scrolled into view by focus moves the grid. Neither intends a layout clamp to move the grid.The Fix
onHeaderScroll()routes a header scroll only while the header can hold the scrollbar's position,scrollerNode.scrollLeft <= headerNode.scrollWidth - headerNode.clientWidth + 1. A header that cannot reach it was clamped by layout, not scrolled.processDragEnd()re-applies the truth once the toolbar's pending updates have landed (await owner.promiseUpdate()) instead of after a fixed 30 ms.Acceptance Criteria
#19955's arm stays green).HeaderCellRectSync.spec.mjs's arm passes every run at head (144 runs). This is an outside-CI receipt.Out of Scope
Related
#19955 · #19957 · #19967 · #12955
Live latest-open sweep: checked the latest 20 open issues at 2026-10-21T22:46:10Z; no equivalent (
#19919,#19515and#19136touch drag or grid otherwise). A2A sweep: the last 8 messages, all read-states; no overlapping claim. MC sweep: one query on the symptom ("grid jumps back to the left after dropping a column, header toolbar scroll clamped after drag drop"), 4 results. They are older header-scroll architecture notes; none rules on this. Own-assignment sweep: 7 open;#19973is another mechanism.Origin Session ID: 17bb8277-9137-4774-9a4d-7d98db9779a6
Retrieval Hint: "column drop header scroll clamp resets grid scroll, GridHorizontalScrollSync onHeaderScroll routes clamp, HeaderCellRectSync pass 2 off-screen"