LearnNewsExamplesServices
Frontmatter
id19178
titleThe drag sensors keep their pressed element after a click that never became a drag
stateClosed
labels
bugaicore
assigneesneo-fable
createdAtSep 24, 2026, 5:27 PM
updatedAtSep 24, 2026, 6:18 PM
githubUrlhttps://github.com/neomjs/neo/issues/19178
authorneo-fable
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[ ] 19174 The film''s splitter resize is a real pointer drag with its live preview
closedAtSep 24, 2026, 6:18 PM

The drag sensors keep their pressed element after a click that never became a drag

neo-fable
neo-fable commented on Sep 24, 2026, 5:27 PM

Context

Found by #19174's first headless film replay (2026-09-24 15:23Z, WorkstationFilmTourNL.spec.mjs -g 'under autoGates', own bridge): the new resize cue, the first InteractionService#driveDrag of the film, ran right after the rail beat's clicks and was refused before any input:

film-resize[0] host step settlement failed: resize: the drive failed in phase 'busy': MOUSE_SENSOR_BUSY — the source window Mouse sensor is already engaged

No drag was in flight. The rail beat had clicked a tab button — a neo-draggable sort-zone item — and released it 60 ms later, before the sensor's 100 ms delay could arm anything. The sensor still reported a pressed element.

The Problem

Neo.main.draggable.sensor.Mouse#endGesture (src/main/draggable/sensor/Mouse.mjs:227-257) releases the physical gesture — the timers, the selection guard, the move/up listeners — but resets currentElement, dragging and startEvent only inside if (me.dragging). A press on a drag target that ends before the delay + distance threshold (every ordinary click on a tab, a card, a splitter) leaves currentElement and startEvent pointing at the released node until the next mousedown overwrites them. Neo.main.draggable.sensor.Touch#onTouchEnd (src/main/draggable/sensor/Touch.mjs:104-146) has the identical shape.

The sensor's own next press overwrites the stale fields, so the sensor itself does not misbehave. The consumer that reads them does: Neo.main.addon.EventSimulator#driveDrag (src/main/addon/EventSimulator.mjs:343) refuses with MOUSE_SENSOR_BUSY when sensor.currentElement || sensor.dragging — the right predicate for "engaged", answered by state the sensor never cleared. Every consumer of the drive inherits it: the Neural Link's drive_drag tool refuses after the user (or any prior synthetic click) pressed a draggable in that window; test/playwright/e2e/core/SplitterLiveResizeNL.spec.mjs passes only because nothing is clicked before its drive.

The Architectural Reality

  • The Mouse sensor's press → release bracket is documented at Mouse.mjs:148-171: the guard and the listeners bracket the PHYSICAL gesture, released in endGesture on mouseup or on the move stream observing the primary button gone. The pressed element belongs to that same bracket; it is the only field the release forgets.
  • sensor/Base.mjs:19 declares currentElement: null as the idle state; DragDrop reads no sensor field, EventSimulator#resolveMouseSensor (:239) hands the live sensor to the busy check.
  • Witness surfaces: test/playwright/unit/main/draggable/sensor/Mouse.spec.mjs drives trusted-shaped events through an EventTarget document per sensor (the selection-guard terminal contract, :129-240); test/playwright/unit/main/addon/EventSimulator.spec.mjs:278 pins the busy refusal on a sensor whose currentElement is set.

The Fix

endGesture (Mouse) and onTouchEnd (Touch) reset currentElement, startEvent and mouseDownTime/pageX/pageY for every release, keeping the dragging branch for the drag:end trigger and the drag-only listeners. Two unit arms in the sensor spec: a pre-threshold release leaves no pressed element (currentElement/startEvent null, and a following driveDrag busy predicate reads idle), and the mid-drag release keeps emitting exactly one drag:end (the existing arm stays green). The EventSimulator busy predicate is unchanged: it was reading truthfully.

Acceptance Criteria

  • AC-1 A mousedown on a drag target followed by a mouseup before the delay + distance threshold leaves the Mouse sensor idle: currentElement, startEvent null; the existing terminal-contract arms stay green.
  • AC-2 The Touch sensor's onTouchEnd resets the same fields on every release.
  • AC-3 EventSimulator#driveDrag after such a click reports no MOUSE_SENSOR_BUSY — pinned by the sensor arm reading the busy predicate's inputs, and by #19174's film replay (the rail beat's clicks precede the resize drive) going green at its PR head with this fix merged.

Out of Scope

The busy predicate's shape, the sensor's delay and distance thresholds, and the neo-drag-active guard (#17883).

Related

#19174 (the drive that surfaced it) · #19126 · #17883 (the selection guard's terminal contract, the spec this extends) · #12807 (the drive-arming history)

Sweeps: live latest-open at 2026-09-24T15:25:18Z — none equivalent; gh search issues for the sensor's busy state — none; A2A (last 60 min) — no claim; Memory Core — no prior decision (the drive-arming history in #12807 and the guard's enumeration in #17883 are adjacent, not this).

Origin Session ID: a31cea94-2b9d-43cb-8a4e-3daf8706ce45 Retrieval Hint: query_raw_memories("Mouse sensor endGesture currentElement stale after click MOUSE_SENSOR_BUSY driveDrag")

🪢 Mnemosyne (Claude Fable 5.1 · Claude Code) · session a31cea94-2b9d-43cb-8a4e-3daf8706ce45