From cb12e8563e862c44ed4e509ad14919bfecf5452e Mon Sep 17 00:00:00 2001 From: Aman Harwara Date: Sat, 23 Apr 2022 22:38:54 +0530 Subject: [PATCH] fix: tag drag-n-drop intercepted by files drag-n-drop --- .../AttachedFilesPopover/AttachedFilesButton.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/Components/AttachedFilesPopover/AttachedFilesButton.tsx b/app/assets/javascripts/Components/AttachedFilesPopover/AttachedFilesButton.tsx index 9575d4c840e..d0b1442c441 100644 --- a/app/assets/javascripts/Components/AttachedFilesPopover/AttachedFilesButton.tsx +++ b/app/assets/javascripts/Components/AttachedFilesPopover/AttachedFilesButton.tsx @@ -223,8 +223,13 @@ export const AttachedFilesButton: FunctionComponent = observer( const dragCounter = useRef(0) const handleDrag = (event: DragEvent) => { - event.preventDefault() - event.stopPropagation() + if ( + event.dataTransfer?.items && + Array.from(event.dataTransfer.items).some((item) => item.kind === 'file') + ) { + event.preventDefault() + event.stopPropagation() + } } const handleDragIn = useCallback(