Skip to content

[bug] Drag-and-Drop doesn't handled properly on Linux #9725

Description

@xingrz

Describe the bug

As far as we know, by default, Tauri handles drag-n-drop via its own tauri://drop and related events.

While in Linux (both Ubuntu 22.04 and 24.04), once a file is dropped onto the window, an tauri://drag-cancelled is emitted instead, and the webview is unexpectedly navigated to the dropped file.

Reproduction

Link: https://github.com/xingrz/tauri-v2-drag-n-drop

  1. Run the demo
  2. Open the Web Inspector, and switch to Console tab. Enable Preserve Log
    image
  3. Drag and drop some file(s) onto the window
image

As its shown in the screenshot below, tauri://drag-cancelled is emitted, and the webview is navigated to the file (package.json) just dropped.

Expected behavior

image

A tauri://drop should be emitted. In the above minimal reproduction, size of the dropped file is displayed.

Full tauri info output

$ npm run tauri info

> tauri-v2-drag-n-drop@0.0.0 tauri
> tauri info


[✔] Environment
    - OS: Ubuntu 24.04 X64
    ✔ webkit2gtk-4.1: 2.44.0
    ✔ rsvg2: 2.58.0
    ✔ rustc: 1.78.0 (9b00956e5 2024-04-29)
    ✔ cargo: 1.78.0 (54d8815d0 2024-03-26)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-aarch64-unknown-linux-gnu (default)
    - node: 20.13.0
    - npm: 10.5.2

[-] Packages
    - tauri [RUST]: 2.0.0-beta.18
    - tauri-build [RUST]: 2.0.0-beta.14
    - wry [RUST]: 0.39.4
    - tao [RUST]: 0.27.1
    - @tauri-apps/api [NPM]: 2.0.0-beta.11
    - @tauri-apps/cli [NPM]: 2.0.0-beta.16

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../dist
    - devUrl: http://localhost:1420/
    - bundler: Vite

Stack trace

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: needs triageThis issue needs to triage, applied to new issuesstatus: upstreamThis issue is blocked by upstream dependencies and we need to wait or contribute upstream fixestype: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions