tray-icon icon indicating copy to clipboard operation
tray-icon copied to clipboard

[bug] Tauri 2.0 system tray on Windows 7 will cause the page in the window to be unclickable

Open tauri-bot opened this issue 7 months ago • 6 comments

This issue has been upstreamed from https://github.com/tauri-apps/tauri/issues/13389

Describe the bug

Use the following method to construct a tray menu. When the mouse clicks on this tray menu, the page in the entire window cannot trigger click events, such as the button click event.

pub fn run() {
    tauri::Builder::default()
        .plugin(tauri_plugin_opener::init())
        .setup(|app| {

            let quit_i = MenuItem::with_id(app, "quit", "Quit", true, None::<&str>)?;
            let menu = Menu::with_items(app, &[&quit_i])?;

            let tray = TrayIconBuilder::new()
                .menu(&menu)
                .menu_on_left_click(true)
                .on_menu_event(|app, event| match event.id.as_ref() {
                    "quit" => {
                        println!("quit menu item was clicked");
                        app.exit(0);
                    }
                    _ => {
                        println!("menu item {:?} not handled", [event.id](http://event.id/));
                    }
                })
                .build(app)?;
            Ok(())
        })
        .invoke_handler(tauri::generate_handler![greet])
        .run(tauri::generate_context!())
        .expect("error while running tauri application");
}

https://github.com/user-attachments/assets/a4dbe141-af1c-424c-9cb7-2810105b9e32

Reproduction

No response

Expected behavior

No response

Full tauri info output

[✔] Environment
    - OS: Windows 10.0.19045 x86_64 (X64)
    ✔ WebView2: 136.0.3240.50
    ✔ MSVC: Visual Studio 生成工具 2022
    ✔ rustc: 1.77.2 (25ef9e3d8 2024-04-09)
    ✔ cargo: 1.77.2 (e52e36006 2024-03-26)
    ✔ rustup: 1.28.1 (f9edccde0 2025-03-05)
    ✔ Rust toolchain: 1.77.2-x86_64-pc-windows-msvc (default)
    - node: 20.11.1
    - pnpm: 7.33.7
    - yarn: 1.22.22
    - npm: 10.9.2

[-] Packages
    - tauri 🦀: 2.2.3, (outdated, latest: 2.5.1)
    - tauri-build 🦀: No version detected
    - wry 🦀: 0.48.1, (outdated, latest: 0.51.2)
    - tao 🦀: 0.31.1, (outdated, latest: 0.33.0)
    - @tauri-apps/api : 2.5.0
    - @tauri-apps/cli : 2.5.0

[-] Plugins
    - tauri-plugin-opener 🦀: 2.2.6
    - @tauri-apps/plugin-opener : 2.2.6

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../dist
    - devUrl: http://localhost:1420/
    - framework: Vue.js
    - bundler: Vite
Done in 24.32s.

Stack trace


Additional context

No response

tauri-bot avatar May 08 '25 10:05 tauri-bot

Not 100% sure yet if it's tray-icon or if there's something in combination with tauri/tao/wry whatever that does this.

FabianLars avatar May 08 '25 10:05 FabianLars

Not 100% sure yet if it's tray-icon or if there's something in combination with tauri/tao/wry whatever that does this.

If necessary, I can provide a demo code to reproduce it.

muwoo avatar May 08 '25 11:05 muwoo

That would be very much appreciated, especially if you can even reproduce it without tauri (not a requirement tho)

FabianLars avatar May 08 '25 11:05 FabianLars

That would be very much appreciated, especially if you can even reproduce it without tauri (not a requirement tho)

You are right. It is indeed related to a combination of various factors. I tried to use only the latest version of Tauri and found that there was no problem. It only appeared when combined with some plugins and some features. I will try to locate which specific combination caused the problem. If there is any progress, I will synchronize it immediately. Thank you for your guidance.

muwoo avatar May 09 '25 08:05 muwoo

@FabianLars I found that there is a problem after compiling into i686-pc-windows-msvc. The following is a simple demo to reproduce the problem. You can run yarn tauri-build to build an nsis installation package, and then test it with win7 to reproduce it.

https://github.com/muwoo/test-win7-tray

muwoo avatar May 12 '25 09:05 muwoo

test-win7-tray crashes on my Windows 7 VMware environment (when right-clicking the tray menu).

Runtime environment

Windows 7 SP1 x86, all updates installed using UpdatePack7R2
WebView2 109.0.1518.140 (x86)
Image

https://github.com/user-attachments/assets/9e2fcad3-268a-4262-a482-c3d6595980b3

Part of the build environment

[✔] Environment
    - OS: Windows 10.0.26100 x86_64 (X64)
    ✔ WebView2: 138.0.3351.109
    ✔ MSVC:
        - Visual Studio Community 2022
        - Visual Studio Build Tools 2022
    ✔ rustc: 1.77.2 (25ef9e3d8 2024-04-09)
    ✔ cargo: 1.77.2 (e52e36006 2024-03-26)
    ✔ rustup: 1.28.2 (e4f3ad6f8 2025-04-28)
    ✔ Rust toolchain: 1.77.2-x86_64-pc-windows-msvc (overridden by the `RUSTUP_TOOLCHAIN` environment variable)

(The order matches the one shown above.)

mcitem avatar Jul 27 '25 17:07 mcitem