Compare commits

..

4 Commits

Author SHA1 Message Date
alex bf561186fb fix(terminal): suppress competing context menus
Stop contextmenu propagation after recognizing selected xterm output so the native browser overlay cannot block Copy.
2026-07-22 14:56:03 +02:00
alex 0afce741eb merge: prioritize terminal selected copy menu 2026-07-22 14:25:21 +02:00
alex 7603b739cb fix(terminal): prioritize selected copy menu
Handle selected-output context menus during capture so xterm and the browser cannot open a competing menu.
2026-07-22 14:25:20 +02:00
alex ff8efdd887 merge: add terminal right click copy action 2026-07-22 14:15:47 +02:00
@@ -498,6 +498,8 @@ export const TerminalComponent = React.forwardRef<TerminalRef, TerminalProps>(
} }
event.preventDefault(); event.preventDefault();
event.stopImmediatePropagation();
event.stopPropagation();
setCopyMenu({ x: event.clientX, y: event.clientY, text: selection }); setCopyMenu({ x: event.clientX, y: event.clientY, text: selection });
}; };
@@ -512,7 +514,7 @@ export const TerminalComponent = React.forwardRef<TerminalRef, TerminalProps>(
pasteTextRef.current(text); pasteTextRef.current(text);
}; };
container.addEventListener("copy", handleBrowserCopy, true); container.addEventListener("copy", handleBrowserCopy, true);
container.addEventListener("contextmenu", handleTerminalContextMenu); container.addEventListener("contextmenu", handleTerminalContextMenu, true);
container.addEventListener("paste", handleBrowserPaste, true); container.addEventListener("paste", handleBrowserPaste, true);
// Mobile touch scroll. // Mobile touch scroll.
@@ -761,7 +763,11 @@ export const TerminalComponent = React.forwardRef<TerminalRef, TerminalProps>(
); );
if (touchCleanup) touchCleanup(); if (touchCleanup) touchCleanup();
container.removeEventListener("copy", handleBrowserCopy, true); container.removeEventListener("copy", handleBrowserCopy, true);
container.removeEventListener("contextmenu", handleTerminalContextMenu); container.removeEventListener(
"contextmenu",
handleTerminalContextMenu,
true,
);
container.removeEventListener("paste", handleBrowserPaste, true); container.removeEventListener("paste", handleBrowserPaste, true);
pasteTextRef.current = () => {}; pasteTextRef.current = () => {};
bracketedPasteEnabledRef.current = false; bracketedPasteEnabledRef.current = false;