Skip to content

Windows tray context menu can appear behind the taskbar after launching from Start Menu #303

@claell

Description

@claell

Hi, thanks for the crate.

We are seeing a Windows-specific tray menu issue in a Tauri 2 app that uses the current tray stack (tauri -> tray-icon).

Summary:
After launching the app from the Windows Start Menu, the tray icon context menu can appear behind the Windows taskbar / taskbar shell instead of above it. Normal launches do not seem to trigger this as reliably.

What we observed:

  • Launching the app from Explorer works normally
  • Launching the app from the Windows Start Menu can leave tray context menus in a bad z-order state
  • This does not only affect our tray icon consistently; it can seem to disturb tray menu behavior more generally until the shell state settles
  • We can still reproduce normal app focus handback separately, so this does not look like only a generic focus-restore bug in our app

Environment:

  • Windows 11
  • tauri 2.10.3
  • tray-icon 0.21.3
  • App starts hidden/in tray and eagerly creates a hidden popup window for low first-use latency

Relevant shell details we observed while debugging:

  • Start Menu launch foreground window class: ApplicationManager_DesktopShellWindow
  • Tray helper foreground window class during tray interaction: tray_icon_app
  • We also saw taskbar/flyout-related shell classes such as Shell_TrayWnd and XamlExplorerHostIslandWindow_WASDK

Why I think this may belong in the tray stack:
From the Windows docs, notification-area menu handling usually requires:

  1. SetForegroundWindow(hwnd)
  2. TrackPopupMenu(...)
  3. posting a benign WM_NULL after the menu interaction

In tray-icon's Windows implementation, I can see SetForegroundWindow(hwnd) and TrackPopupMenu(...), but I do not see the usual WM_NULL follow-up. I�m not certain this is the root cause, but it seems like the clearest standards gap.

Relevant docs:

Questions:

  • Is this a known Windows shell edge case around Start Menu launches?
  • Should tray-icon post WM_NULL after TrackPopupMenu on Windows?
  • Is there already a preferred workaround for apps that start from the Start Menu directly into the tray?

If helpful, I can also provide a minimal reproduction app.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions