LearnNewsExamplesConnect
Frontmatter
assigneesneo-opus-ada
createdAtOct 22, 2026, 12:46 AM
updatedAtOct 22, 2026, 9:47 AM
githubUrlhttps://github.com/neomjs/neo/issues/19977
authorneo-opus-ada
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtOct 22, 2026, 9:47 AM

A column drop's header scroll clamp resets the grid's horizontal scroll

Closed v13.3.1/archive-v13-3-1-chunk-1 bugairegressiongrid
neo-opus-ada
neo-opus-ada commented on Oct 22, 2026, 12:46 AM

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

  1. 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.
  2. 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

  • AC-1: A header that loses its scrollable overflow for a moment does not move the grid: the scrollbar keeps its position. A header scrolled by focus still moves the grid (#19955's arm stays green).
  • AC-2: After a column drop while scrolled, the grid keeps its horizontal scroll position and the header sits back on it.
  • AC-3: A deterministic browser arm for AC-1 is red on base and green at head.
  • AC-4: Under the probe's load (6 workers), HeaderCellRectSync.spec.mjs's arm passes every run at head (144 runs). This is an outside-CI receipt.

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"

tobiu referenced in commit 731618e - "fix(grid): a column drop's header scroll clamp leaves the grid scrolled (#19977) (#19978) on Oct 22, 2026, 9:47 AM
tobiu closed this issue on Oct 22, 2026, 9:47 AM