Skip to content

Document context menu opens over modal dialogs and its actions are clickable #216

Description

@PathGao

Summary

While an in-app modal dialog is showing (e.g. the unsaved-changes dialog), right-clicking anywhere still opens the document context menu (Select All / Open File Location / Edit / Close File) on top of the modal's overlay — and its items are clickable.

Reproduction

  1. Make a tab dirty and close it (or close the window) so the unsaved-changes modal appears.
  2. Right-click anywhere in the window.
  3. The document context menu opens over the dimmed overlay; "Close File" / "Edit" can be invoked mid-dialog.

Mechanism

The modal overlay blocks left-clicks on the UI underneath, but the document context menu is bound at the document level via the contextmenu event, which the overlay does not intercept. So the overlay stops direct interaction with tabs/buttons, yet the document menu remains a reachable side door into actions (Edit, Close File) that can race the modal's own flow — e.g. "Close File" can start a second close path while the dialog's walk is mid-flight.

Suggested fix

Gate the document contextmenu handler on "no modal open" (the modal's visibility state already exists), or have the overlay capture and stop contextmenu like it does clicks.

(Noticed while QA-ing #214, but the substrate — modal overlay + document-level context menu — is upstream behavior reproducible in a single window.)

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions