From dd39cca043e44351691bb5792ed726aa21a9148d Mon Sep 17 00:00:00 2001 From: Sebin Song Date: Fri, 26 Jul 2024 06:10:20 +1200 Subject: [PATCH] #2244 - Drag and Drop file upload doesn't work in Safari (#2253) * remove the items check * flaky test --- frontend/views/containers/chatroom/ChatMain.vue | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/frontend/views/containers/chatroom/ChatMain.vue b/frontend/views/containers/chatroom/ChatMain.vue index f3adaa34e..172130348 100644 --- a/frontend/views/containers/chatroom/ChatMain.vue +++ b/frontend/views/containers/chatroom/ChatMain.vue @@ -2,7 +2,6 @@ .c-chat-main( v-if='summary.chatRoomID' :class='{ "is-dnd-active": dndState && dndState.isActive }' - @dragstart='dragStartHandler' @dragover='dragStartHandler' ) drag-active-overlay( @@ -1087,17 +1086,15 @@ export default ({ }, 250), // Handlers for file-upload via drag & drop action dragStartHandler (e) { - // handler function for 'dragstart', 'dragover' events - const items = Array.from(e?.dataTransfer?.items) || [] - - if (items.some(entry => entry.kind === 'file')) { // check if the detected content is something attachable to the chat. - if (!this.dndState.isActive) { - this.dndState.isActive = true - } + e.preventDefault() + // handler function for 'dragstart', 'dragover' events. - // give user a correct feedback about what happens upon 'drop' action. (https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API) - e.dataTransfer.dropEffect = 'copy' + if (!this.dndState.isActive) { + this.dndState.isActive = true } + + // give user a correct feedback about what happens upon 'drop' action. (https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API) + e.dataTransfer.dropEffect = 'copy' }, dragEndHandler (e) { // handler function for 'dragleave', 'dragend', 'drop' events