Markpad icon indicating copy to clipboard operation
Markpad copied to clipboard

In-app menus are not mutually exclusive (hamburger + context menus can be open at once)

Open PathGao opened this issue 4 months ago • 0 comments

Summary

The in-app menus (the titlebar hamburger menu and the context menus) are not mutually exclusive: opening one does not dismiss another that is already open, so two menus can be on screen at once.

Reproduction

  1. Left-click the titlebar hamburger to open its menu.
  2. Without clicking elsewhere, right-click a tab (or the document area).
  3. The context menu opens while the hamburger menu stays open.

The stale menu also survives focus loss — e.g. it remains open while another window comes to the foreground.

Mechanism

Each menu instance dismisses itself on an outside left-click (click/mousedown listeners), but:

  • a contextmenu (right-click) event is not one of the dismissal triggers, so opening menu B never closes menu A;
  • window blur / focus change is not a dismissal trigger either, so a menu outlives the window's foreground status.

There is no shared "only one menu open" coordination between the independent menu components.

Suggested fix

Either dismiss on contextmenu + window blur in the shared ContextMenu component, or introduce a tiny module-level "current open menu" token so opening any menu closes the previous one. Both are local to the menu component and need no changes at call sites.

(Noticed while QA-ing the multiwindow work in #214; independent of it — reproducible in a single window.)

🤖 Generated with Claude Code

PathGao avatar Jul 13 '26 00:07 PathGao