From 503631764a41f0bc6e5b86ab38f671e389e207c6 Mon Sep 17 00:00:00 2001 From: whoswhip Date: Sat, 14 Nov 2026 15:18:44 -0500 Subject: [PATCH] fix dnd --- static/js/dnd.js | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/static/js/dnd.js b/static/js/dnd.js index 71a3eab..80a5fa1 100644 --- a/static/js/dnd.js +++ b/static/js/dnd.js @@ -1,13 +1,10 @@ const fileInput = document.getElementById("upload-file"); -let dragDepth = 0; - function isFile(event) { return event.dataTransfer.types.includes("Files"); } function resetDrag() { - dragDepth = 0; document.body.classList.remove("dragging"); } @@ -15,7 +12,6 @@ document.addEventListener("dragenter", (event) => { if (!isFile(event)) return; event.preventDefault(); - dragDepth++; document.body.classList.add("dragging"); }); @@ -27,11 +23,7 @@ document.addEventListener("dragover", (event) => { }); document.addEventListener("dragleave", () => { - dragDepth = Math.max(0, dragDepth - 1); - - if (dragDepth === 0) { - document.body.classList.remove("dragging"); - } + resetDrag(); }); document.addEventListener("drop", (event) => {