From b359082566ca1a3bdcf7b6eed169d0993846f019 Mon Sep 17 00:00:00 2001 From: MaheshtheDev <38828053+MaheshtheDev@users.noreply.github.com> Date: Tue, 12 May 2026 05:49:32 +0000 Subject: [PATCH] fix: apply review feedback for global drag-and-drop - Guard all drag handlers behind Files type check to avoid breaking non-file drops - Fix counter drift on non-file drags (early return when not Files) - Add biome-ignore for static div accessibility lint - Improve 'all unsupported' error message clarity - Add explanatory comment on initialFiles seeding bypass --- apps/web/app/(app)/page.tsx | 11 +++++++---- apps/web/components/add-document/index.tsx | 6 +++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/apps/web/app/(app)/page.tsx b/apps/web/app/(app)/page.tsx index 4b5a5209..dfde8863 100644 --- a/apps/web/app/(app)/page.tsx +++ b/apps/web/app/(app)/page.tsx @@ -390,14 +390,14 @@ export default function NewPage() { const handleGlobalDragEnter = useCallback((e: React.DragEvent) => { e.preventDefault() + if (!e.dataTransfer.types.includes("Files")) return globalDragCounter.current++ - if (e.dataTransfer.types.includes("Files")) { - setIsGlobalDragging(true) - } + setIsGlobalDragging(true) }, []) const handleGlobalDragLeave = useCallback((e: React.DragEvent) => { e.preventDefault() + if (!e.dataTransfer.types.includes("Files")) return globalDragCounter.current-- if (globalDragCounter.current === 0) { setIsGlobalDragging(false) @@ -405,11 +405,13 @@ export default function NewPage() { }, []) const handleGlobalDragOver = useCallback((e: React.DragEvent) => { + if (!e.dataTransfer.types.includes("Files")) return e.preventDefault() }, []) const handleGlobalDrop = useCallback( (e: React.DragEvent) => { + if (!e.dataTransfer.types.includes("Files")) return e.preventDefault() globalDragCounter.current = 0 setIsGlobalDragging(false) @@ -421,7 +423,7 @@ export default function NewPage() { toast.error( files.length === 1 ? "This file type is not supported" - : `${files.length} files are not supported`, + : `None of the ${files.length} files are supported`, ) } return @@ -595,6 +597,7 @@ export default function NewPage() { return ( + {/* biome-ignore lint/a11y/noStaticElementInteractions: global file drag-and-drop zone requires event handlers on a div */}
{ if (!isOpen) {