From a411459ec79d49d5ab26438ee1dfee9276fadffc Mon Sep 17 00:00:00 2001 From: Ville Ahlgren Date: Mon, 17 Aug 2026 09:44:29 +0300 Subject: [PATCH] fix(v2/linux): allow both native and HTML5 drag-and-drop Mark handled native file drops as consumed to prevent WebKit from navigating to the dropped file. Additionally, keep the GTK enabled so that EnableFileDrop and DisableWebViewDrop can be used together. --- v2/internal/frontend/desktop/linux/window.c | 4 ++-- website/src/pages/changelog.mdx | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/v2/internal/frontend/desktop/linux/window.c b/v2/internal/frontend/desktop/linux/window.c index 5441db022cc..6906a0cc7c1 100644 --- a/v2/internal/frontend/desktop/linux/window.c +++ b/v2/internal/frontend/desktop/linux/window.c @@ -551,7 +551,7 @@ static gboolean onDragDrop(GtkWidget* self, GdkDragContext* context, gint x, gin } processMessage(res); - return FALSE; + return TRUE; } // WebView @@ -566,7 +566,7 @@ GtkWidget *SetupWebview(void *contentManager, GtkWindow *window, int hideWindowO webkit_web_context_register_uri_scheme(context, "wails", (WebKitURISchemeRequestCallback)processURLRequest, NULL, NULL); g_signal_connect(G_OBJECT(webview), "load-changed", G_CALLBACK(webviewLoadChanged), NULL); - if(disableWebViewDragAndDrop) + if(disableWebViewDragAndDrop && !enableDragAndDrop) { gtk_drag_dest_unset(webview); } diff --git a/website/src/pages/changelog.mdx b/website/src/pages/changelog.mdx index bea883a70be..4019d9e3809 100644 --- a/website/src/pages/changelog.mdx +++ b/website/src/pages/changelog.mdx @@ -17,6 +17,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Added `EnableAutoplayWithoutUserAction` macOS webview preference to allow HTML5 media to autoplay without a user gesture [#5512](https://github.com/wailsapp/wails/pull/5512) by @Eyalm321 +### Fixed + +- Fixed drag-and-drop on Linux, allowing both native file drops and HTML5 drag-and-drop to work without WebKit navigating to externally dropped files. + ## v2.14.0 - 2026-08-10 ### Fixed