From c1d0978d00d93f3be324c2be765695546966dd6d Mon Sep 17 00:00:00 2001 From: Patryk Skrzyniarz Date: Wed, 29 Jul 2026 17:04:10 +0200 Subject: [PATCH] fix: detach resize-handle document listeners on destroy before move threshold DDResizableHandle.destroy() only called _mouseUp when moving was true, so a handle torn down between mousedown and the 3px threshold left document mousemove/mouseup listeners attached and threw on every subsequent mouse event. Guard on mouseDownEvent instead, matching DDDraggable.destroy(). Fixes #3345 Co-authored-by: Cursor --- src/dd-resizable-handle.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/dd-resizable-handle.ts b/src/dd-resizable-handle.ts index 47d0ba5d7..57753e436 100644 --- a/src/dd-resizable-handle.ts +++ b/src/dd-resizable-handle.ts @@ -66,7 +66,9 @@ export class DDResizableHandle { /** call this when resize handle needs to be removed and cleaned up */ public destroy(): DDResizableHandle { - if (this.moving) this._mouseUp(this.mouseDownEvent!); + // Clean up whenever a gesture is armed (mousedown), not only after the + // 3px threshold flips `moving`. Mirrors DDDraggable.destroy(). See #3345. + if (this.mouseDownEvent) this._mouseUp(this.mouseDownEvent); this.el.removeEventListener('mousedown', this._mouseDown); if (isTouch) { this.el.removeEventListener('touchstart', touchstart);