From 6d2f2f1012dd889da08416b0a40c604e5779907b Mon Sep 17 00:00:00 2001 From: mathuo <6710312+mathuo@users.noreply.github.com> Date: Tue, 29 Apr 2025 21:44:55 +0100 Subject: [PATCH] bug: fix ghost image rendering --- packages/dockview-core/src/dnd/ghost.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/dockview-core/src/dnd/ghost.ts b/packages/dockview-core/src/dnd/ghost.ts index df976c7cf..9573566b3 100644 --- a/packages/dockview-core/src/dnd/ghost.ts +++ b/packages/dockview-core/src/dnd/ghost.ts @@ -8,6 +8,9 @@ export function addGhostImage( // class dockview provides to force ghost image to be drawn on a different layer and prevent weird rendering issues addClasses(ghostElement, 'dv-dragged'); + // move the element off-screen initially otherwise it may in some cases be rendered at (0,0) momentarily + ghostElement.style.top = '-9999px'; + document.body.appendChild(ghostElement); dataTransfer.setDragImage(ghostElement, options?.x ?? 0, options?.y ?? 0);