Skip to content

fix(terminal): suppress context menu during mouse tracking#730

Draft
IGUNUBLUE wants to merge 1 commit into
crynta:mainfrom
IGUNUBLUE:fix/terminal-right-click-context-menu
Draft

fix(terminal): suppress context menu during mouse tracking#730
IGUNUBLUE wants to merge 1 commit into
crynta:mainfrom
IGUNUBLUE:fix/terminal-right-click-context-menu

Conversation

@IGUNUBLUE

Copy link
Copy Markdown

What

Suppress the terminal pane's native browser/WebKit context menu while xterm.js reports that terminal mouse tracking is active.

Closes #721.

Why

TUI apps that enable mouse reporting can receive right-clicks and render their own context menus, but the native Terax/WebKit context menu was still opening on top and blocking the app menu.

How

  • Read xterm.js Terminal.modes.mouseTrackingMode and treat every non-none mode as terminal-owned mouse input.
  • Install a native contextmenu listener on the terminal container and call preventDefault() only while mouse tracking is active.
  • Keep the native context menu available when no terminal app has mouse reporting enabled.

Testing

  • pnpm exec tsc --noEmit clean via pnpm check-types
  • pnpm test src/modules/terminal/lib/mouseTracking.test.ts
  • pnpm lint ran; it reports existing repository warnings outside this change, with no new terminal-file errors from this PR
  • Manual smoke-test of the affected feature
  • (If you touched src-tauri/) cargo test --locked and cargo clippy --all-targets --locked -- -D warnings clean
  • (If you changed a #[tauri::command] signature) called out below so the FE caller can be updated in lockstep
  • (If UI) tested in pnpm tauri dev
  • Platforms tested: Linux checks only; macOS/WebKit runtime not available in this environment
  • Shells tested (if relevant): N/A

Screenshots / GIFs

N/A. This suppresses a native context menu during terminal mouse tracking; no local macOS/WebKit runtime was available for before/after capture.

Notes for reviewer

The change is intentionally scoped to xterm's documented mouse tracking modes (x10, vt200, drag, any). Native context menus still work when mouseTrackingMode is none.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Native context menu appears on right-click in terminal panes, blocking TUI apps' own right-click menus

1 participant