-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Open
Description
Describe the bug
In Tauri 2, dynamically created windows with visible = false never receive drag & drop events, even after calling window.show() later.
However, windows defined in tauri.conf.json with the same setting (visible = false) work correctly after being shown.
This results in inconsistent behavior between JSON-defined windows and dynamically created windows.
For windows created via Rust:
config.visible = false;
config.drag_drop_enabled = true;
let win = WebviewWindowBuilder::from_config(app, &config).build()?;
win.show()?;- Dragging a file over the window shows a forbidden cursor
- No drag/drop events fire (
tauri://drag-enter,tauri://drag-over, etc.) - Changing
visible = true→ works - Defining the same window in JSON (
visible=false) → works
Reproduction
- No windows in
tauri.conf.json:
"app": { "windows": [] }- Create window dynamically with
visible=false
let mut config = WindowConfig::default();
config.label = "test";
config.url = WebviewUrl::App("/index.html".into());
config.visible = false;
config.drag_drop_enabled = true;
let win = WebviewWindowBuilder::from_config(app, &config).build()?;
win.show()?;- Drag a file into the window
No events fire; cursor forbidden.
Expected behavior
A dynamically created window with visible = false should initialize drag & drop normally once it is shown, just like a JSON-defined window does.
Full tauri info output
[✔] Environment
- OS: Windows 10.0.26100 x86_64 (X64)
✔ WebView2: 143.0.3650.66
✔ MSVC: Visual Studio 生成工具 2022
✔ rustc: 1.91.1 (ed61e7d7e 2025-11-07)
✔ cargo: 1.91.1 (ea2d97820 2025-10-10)
✔ rustup: 1.28.2 (e4f3ad6f8 2025-04-28)
✔ Rust toolchain: stable-x86_64-pc-windows-msvc (default)
- node: 22.14.0
- pnpm: 10.15.1
- npm: 11.2.0
[-] Packages
- tauri 🦀: 2.9.4, (outdated, latest: 2.9.5)
- tauri-build 🦀: 2.5.3
- wry 🦀: 0.53.5
- tao 🦀: 0.34.5
- tauri-cli 🦀: 2.9.5 (outdated, latest: 2.9.6)
[-] Plugins
- tauri-plugin-positioner 🦀: 2.3.1
- tauri-plugin-single-instance 🦀: 2.3.6
- tauri-plugin-autostart 🦀: 2.5.1
- tauri-plugin-fs 🦀: 2.4.4
- tauri-plugin-updater 🦀: 2.9.0
- tauri-plugin-dialog 🦀: 2.4.2
- tauri-plugin-store 🦀: 2.4.1
- tauri-plugin-notification 🦀: 2.3.3
- tauri-plugin-log 🦀: 2.7.1
- tauri-plugin-opener 🦀: 2.5.2
- tauri-plugin-shell 🦀: 2.3.3
[-] App
- build-type: build
- CSP: unset
- frontendDist: ../../../frontend/dist
- devUrl: http://localhost:1420/
Stack trace
Additional context
No response