fix(chat): prevent sortable sidebar drags from triggering file upload overlay (#25675)

Add a custom MIME type (application/x-open-webui-drag) to intentional
chat and folder drag sources. The onDragOver handler in MessageInput
now checks for this type instead of the generic text/plain, which
SortableJS also sets during reorder operations for pinned menu items
(Notes, Workspace) and pinned Models.
This commit is contained in:
G30 authored and GitHub committed 2026-06-29 04:58:30 -05:00
1 parent 416baef813
commit 4fa3a74827
4 files changed
+17 -2

No files matched your search

+7 -2
View File
@@ -857,8 +857,13 @@
const onDragOver = (e: DragEvent) => { const onDragOver = (e: DragEvent) => {
e.preventDefault(); e.preventDefault();
// Check if a file or a sidebar chat item is being dragged. // Check if a file or a sidebar chat/folder item is being dragged.
if (e.dataTransfer?.types?.includes('Files') || e.dataTransfer?.types?.includes('text/plain')) { // Use a custom MIME type to distinguish intentional drags from SortableJS reorder drags
// (e.g. Notes, Workspace, pinned Models), which also set 'text/plain'.
if (
e.dataTransfer?.types?.includes('Files') ||
e.dataTransfer?.types?.includes('application/x-open-webui-drag')
) {
dragged = true; dragged = true;
} else { } else {
dragged = false; dragged = false;
+4
View File
@@ -88,6 +88,10 @@
} finally { } finally {
draggedOver = false; draggedOver = false;
} }
// Only process the first non-file item; all share the same
// text/plain payload, so continuing would duplicate the drop.
break;
} }
} }
} }
@@ -266,6 +266,7 @@
id: id id: id
}) })
); );
event.dataTransfer.setData('application/x-open-webui-drag', '');
dragged = true; dragged = true;
itemElement.style.opacity = '0.5'; // Optional: Visual cue to show it's being dragged itemElement.style.opacity = '0.5'; // Optional: Visual cue to show it's being dragged
@@ -206,6 +206,10 @@
} catch (error) { } catch (error) {
console.log('Error parsing dataTransfer:', error); console.log('Error parsing dataTransfer:', error);
} }
// Only process the first non-file item; all share the same
// text/plain payload, so continuing would duplicate the move.
break;
} }
} }
} }
@@ -243,6 +247,7 @@
id: folderId id: folderId
}) })
); );
event.dataTransfer.setData('application/x-open-webui-drag', '');
dragged = true; dragged = true;
folderElement.style.opacity = '0.5'; // Optional: Visual cue to show it's being dragged folderElement.style.opacity = '0.5'; // Optional: Visual cue to show it's being dragged