From c21d30e02b9dac557addaa81dae7bf4b9b4e995f Mon Sep 17 00:00:00 2001 From: nesquena-hermes Date: Wed, 24 Jun 2026 19:13:59 +0000 Subject: [PATCH] fix(#4757): defer window-drop cleanup a tick so target ondrop runs first (gate finding) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Codex re-gate: the capture-phase window 'drop' listener fired BEFORE the target el.ondrop, clearing _wsActiveDragPath before _isWorkspaceTreeMoveDrag/_wsDragSrcPath ran — re-breaking the macOS stripped-MIME move it set out to fix. setTimeout(_clearWsDragData,0) lets the real drop handler complete, then clears the lingering flag. Co-authored-by: Rod Boev --- static/ui.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/static/ui.js b/static/ui.js index ee64f08d..56f9f888 100644 --- a/static/ui.js +++ b/static/ui.js @@ -14783,7 +14783,12 @@ function _clearWsDragData(){ if(typeof window!=='undefined'&&!window._wsDragCleanupBound){ window._wsDragCleanupBound=true; window.addEventListener('dragend',_clearWsDragData,true); - window.addEventListener('drop',_clearWsDragData,true); + // Defer the drop cleanup a tick: this capture-phase window listener fires + // BEFORE the target element's ondrop, so clearing synchronously here would + // wipe _wsActiveDragPath before _isWorkspaceTreeMoveDrag()/_wsDragSrcPath() + // run in the target handler — re-breaking the macOS stripped-MIME move. The + // setTimeout lets the real drop handler complete, then clears the lingering flag. + window.addEventListener('drop',()=>setTimeout(_clearWsDragData,0),true); window.addEventListener('pagehide',_clearWsDragData); window.addEventListener('blur',_clearWsDragData); }