LearnNewsExamplesServices
Frontmatter
id19303
titleDrag start throws when the pressed node is replaced during the start delay
stateClosed
labels
bugairegressioncoredashboard
assigneesneo-opus-grace
createdAtSep 26, 2026, 11:30 PM
updatedAtSep 27, 2026, 10:46 AM
githubUrlhttps://github.com/neomjs/neo/issues/19303
authorneo-opus-grace
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[x] 19288 Headless Chrome''s 800 px screen clamps every script-moved popup
closedAtSep 27, 2026, 10:46 AM

Drag start throws when the pressed node is replaced during the start delay

Closed v13.2.0/archive-v13-2-0-chunk-23 bugairegressioncoredashboard
neo-opus-grace
neo-opus-grace commented on Sep 26, 2026, 11:30 PM

Context

This came out of #19288's red arm, WorkstationDragAffordancesNL › "the ordinary body-mounted tab proxy has a theme-owned surface in both modes", which fails under the 1920×1080 headless screen. The second (light) pass presses the Audit tab header and moves 17 px. On failing runs:

  • the main-thread Mouse sensor holds currentElement: neo-tab-header-button-17, dragging: true;
  • Neo.main.addon.DragDrop holds dragZoneId: null, dragElementRootId: null;
  • the App's tab SortZone never logs an onDragStart, and no proxy appears;
  • the page throws event.target.getBoundingClientRect is not a function at DragDrop.onDragStart (DragDrop.mjs:654). The stack runs Mouse.startDrag ← onDistanceChange ← the start-delay timeout (Mouse.mjs:179).

The same arm passes when a settle separates the preceding theme switch from the press. Measured on the #19288 branch, 2026-09-26, with App-worker logs read back through Neural Link.

The Problem

sensor/Base#trigger dispatches a sensor event on document when the pressed node is no longer connected. Its JSDoc explains why: a gesture's own side effects can remove or replace the source node, and a detached node swallows the event. It also states the contract: consumers read event.detail, never the dispatch target. That fallback came with #15282.

DragDrop#onDragStart still reads the dispatch target:

  • event.target.getBoundingClientRect(): document has no such method, so the handler throws before it resolves the zone or sends drag:start;
  • event.path || event.composedPath(): from a document dispatch that is [document, window], so even without the throw, the zone could not be resolved from the path.

getEventData builds the App payload's path the same way. Every other drag event reaches the App by dragZoneId (manager/DomEvent#fire). drag:start is the one routed through component listeners, by path.

So when the pressed node is replaced between mousedown and the start threshold, the gesture dies silently. The sensor believes it is dragging, while no zone and no App session exist. A tab header re-rendered by a theme switch or an Overflow projection inside the 100 ms start delay is enough.

The Architectural Reality

  • src/main/draggable/sensor/Mouse.mjs#startDrag already puts the press's own path (path: startEvent.path, captured at mousedown) and the pressed element into detail.
  • src/main/addon/DragDrop.mjs#onDragStart resolves dragZoneId from the path against zoneRegistrations, which are keyed by drag element root id. It records dragProxyRect / offsetX / offsetY from the pressed node's rect. getEventData serializes the path for the App.
  • A replaced node keeps its id: the vdom re-renders the same component. The press's path therefore still names the right ids, and the replacement node with that id has the live geometry.

The Fix

DragDrop reads the sensor's detail, as Base#trigger documents:

  1. onDragStart and getEventData take the path from detail.path, falling back to the dispatch path only when detail carries none.
  2. onDragStart measures the pressed element from detail.element, or from the connected node with its id when it was replaced, instead of from event.target.

Acceptance Criteria

  • AC-1: a unit arm dispatches drag:start from document with a pressed element that was replaced by a same-id node. onDragStart does not throw, resolves the owning dragZoneId from the press's path, measures the replacement node, and sends drag:start whose path names the pressed element's ids.
  • AC-2: the connected-node case keeps today's zone, rect and path (existing arms green).
  • AC-3: under #19288's 1920×1080 flag, the tab-proxy arm's light pass no longer loses its drag start: no getBoundingClientRect page error, and the tab SortZone opens a session.

AC-3 amended 2026-09-26 by the author, after measuring the fix. The original AC-3 asked the whole arm to pass. With the fix, the start is delivered on every run. The arm then meets a second layer: the press re-renders the header, and on some runs no connected successor exists at the start, so the proxy is sized from an empty rect (2 px against 48). That layer is not this defect: it is #19285's focused-tab churn (the Overflow projection withholding the focused tab), fixed by #19294 (merged as a50ae57ce8). With #19294's Overflow diff applied on top of this fix, the arm went 8/8 isolated and 2/2 whole-file (2026-09-26). Corrected 2026-09-27: this line first named #19288, which carries only the screen flag.

Out of Scope

  • Why the header node is replaced right after a theme switch. A re-render there is legitimate; the drag must survive it.
  • Pointer Events migration (#17889).

Related

Blocks #19288. Regression from #15282. Touches the same file as open PR #19301 (Escape across windows; different methods).

Live latest-open sweep: the latest 20 open neo issues at 2026-09-26T21:35Z hold no equivalent (newest #19300, Escape delivery across windows, which is a different path). Exact-error search getBoundingClientRect is not a function: no issue. A2A in-flight sweep: no claim on DragDrop's start path; Ada's #19301 changes the Escape guard and adds a remote cancel. Memory Core problem-noun sweep: no prior decision. Own assignments: #19288 (blocked by this), #17889 (pointer migration, not this).

Origin Session ID: 6408fcd4-3571-4ec2-8009-b4dae5d18917 Retrieval Hint: "DragDrop onDragStart detached pressed node document dispatch getBoundingClientRect"

tobiu referenced in commit e4b9f54 - "fix(main): a drag start reads the press from the sensor when a re-render replaced its node (#19303) on Sep 26, 2026, 11:51 PM
tobiu referenced in commit ed5aac1 - "fix(main): a drag start reads the press from the sensor when a re-render replaced its node (#19303) (#19304) on Sep 27, 2026, 10:46 AM
tobiu closed this issue on Sep 27, 2026, 10:46 AM