wailsapp / wailsapp/wails

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

Open
#3,985 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Linux MacOS P2 v2 Windows
Dominant language
Go
Stars
36.3k
Forks
1.9k
Avg merge
2d 11h
Merged PRs (30d)
33

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the runtime.OnFileDrop backend handler and the JavaScript drop and dragover handlers described in the issue, then reproduce with wails build -platform windows/amd64 -windowsconsole -debug and the linked reproduction project. Done means a file drop on Windows 10 triggers the backend handler and provides the usable file path, while the existing JavaScript drop event still behaves as expected.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, javascript
Domain
backend, desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.