Windows tray: activation click also opens the menu, and right-click can open two stacked menus

Open
#767 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
69/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
cpp, zig
Domain
desktop

Research direction

Start in src/platform/windows/webview2_host.cpp, reading the tray handling in windowProc and showTrayMenu() to trace how activation and right-click events reach the menu. Reproduce the reported behavior on Windows 11 with an activation_command, then check it again without one. Done means left-click dispatches the configured command without opening the menu and right-click opens only one menu.

Written by the indexing model from the issue text.

Description

I’m primarily a backend TypeScript developer, so apologies for the shallow C++/Zig diagnosis 😆 this looks like the Windows tray host rather than the Zig core.

My Native SDK app configures a tray activation_command (show/hide) and has normal tray menu items. On Windows 11, left-clicking the tray icon runs the activation command and opens the context menu. I only want the activation command on left-click; the menu should be the right-click action.

Separately, some Windows shells deliver both WM_CONTEXTMENU and WM_RBUTTONUP for a tray right-click. Both paths call showTrayMenu(), so two menus get stacked and I have to click twice to choose an item.

I currently have a local patch oof src/platform/windows/webview2_host.cpp that:

  • only calls showTrayMenu() from the activation branch when tray_activation_command is empty;
  • debounces showTrayMenu() for 300 ms to collapse duplicate context-menu events.

It works, but I'd like to remove the patch.

Likely area: the tray handling in windowProc and showTrayMenu(). If activation_command is configured, left-click should only dispatch it. For right-click, one of the two context events should drive the menu, or the duplicate should be coalesced at the event level rather than relying on a global debounce.

Steps to reproduce (TODO to verify):

  • Build a Windows Native SDK tray app with an activation_command and at least one menu item.
  • Left-click the tray icon: observe the command running and the menu opening; expected only the command.
  • Right-click the tray icon: observe two stacked menus / needing two clicks to choose; expected one menu and one click.
  • Re-test with no activation_command, to confirm the intended default left-click/menu behavior.

Happy to test a candidate build or provide more details 😉

Some system info:

  • Affected/Tested Native SDK versions: 0.10.1, 0.11.1
  • OS: Windows 11 x64
Dominant language
Zig
Stars
7.9k
Forks
335
Avg merge
10h 33m
Merged PRs (30d)
147

Getting set up

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.

More from vercel-labs/native

All issues in vercel-labs/native

Similar issues

More Desktop Dev issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.