wails icon indicating copy to clipboard operation
wails copied to clipboard

Windows 10 doesn't receive drag and drop events on the backend

Open makew0rld opened this issue 10 months ago • 3 comments

Description

In the backend I have a drop handler registered with runtime.OnFileDrop. In the frontend I have this, as per here:

addEventListener("drop", (event) => {
  event.preventDefault();
});
addEventListener("dragover", (event) => {
  event.preventDefault();
});

When testing in Windows 10, my backend drop handler never gets run when I drop a file. If I add a console logging line to the drop event in JavaScript however, that does run. So it seems Wails is not propagating the event to the backend properly.

To Reproduce

  1. Clone https://github.com/makew0rld/wails-issue-3985
  2. Build for Windows (I am doing so on Arch Linux): wails build -platform windows/amd64 -windowsconsole -debug
  3. Open the .exe in Windows (a Windows 10 VM in my case)
  4. Open the web console using the right-click menu
  5. Drag in a file
  6. Observe how nothing appears in the backend console, but a drop event appears in the web console

Expected behaviour

Backend drop handlers are triggered on Windows 10.

Screenshots

No response

Attempted Fixes

No response

System Details

These are the details of the system I'm building the binary on.

# Wails
Version         | v2.9.2
Package Manager | pacman

# System
┌───────────────────────────────────────────────────────────────────────────────────────┐
| OS           | Arch Linux                                                             |
| Version      | Unknown                                                                |
| ID           | arch                                                                   |
| Go Version   | go1.23.3                                                               |
| Platform     | linux                                                                  |
| Architecture | amd64                                                                  |
| CPU          | 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz                         |
| GPU          | TigerLake-LP GT2 [Iris Xe Graphics] (Intel Corporation) - Driver: i915 |
| Memory       | 15GB                                                                   |
└───────────────────────────────────────────────────────────────────────────────────────┘

# Dependencies
┌─────────────────────────────────────────────────────────────────────┐
| Dependency | Package Name | Status    | Version                     |
| *docker    | docker       | Installed | 1:27.3.1-1                  |
| gcc        | gcc          | Installed | 14.2.1+r134+gab884fffe3fc-1 |
| libgtk-3   | gtk3         | Installed | 1:3.24.43-4                 |
| libwebkit  | webkit2gtk   | Installed | 2.46.4-1                    |
| npm        | npm          | Installed | 10.9.2-1                    |
| pkg-config | pkgconf      | Installed | 2.3.0-1                     |
└────────────────────── * - Optional Dependency ──────────────────────┘

# Diagnosis
 SUCCESS  Your system is ready for Wails development!

Additional context

Seems related to #3782 but I wanted to create a new thread because that one is all over the place.

Unfortunately using the JavaScript handler is not really an option in my case as I would like to open the file directly on the user's system for efficiency and JavaScript doesn't give the full file path.

makew0rld avatar Jan 07 '25 01:01 makew0rld