Skip to content

Commit 9dabc13

Browse files
authored
Web: Ctrl-click on tab should open context menu but not open tab (microsoft#165894) (microsoft#165895)
Web: Ctrl-click on tab should open context menu but not open tab (fix microsoft#165894)
1 parent 6187978 commit 9dabc13

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/vs/workbench/browser/parts/editor/editorGroupView.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,8 +404,8 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
404404
const handleTitleClickOrTouch = (e: MouseEvent | GestureEvent): void => {
405405
let target: HTMLElement;
406406
if (e instanceof MouseEvent) {
407-
if (e.button !== 0 || (isMacintosh && e.ctrlKey)) {
408-
return undefined; // only for left mouse click (ctrl+click on macos is right-click)
407+
if (e.button !== 0 /* middle/right mouse button */ || (isMacintosh && e.ctrlKey /* macOS context menu */)) {
408+
return undefined;
409409
}
410410

411411
target = e.target as HTMLElement;

src/vs/workbench/browser/parts/editor/tabsTitleControl.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -691,12 +691,12 @@ export class TabsTitleControl extends TitleControl {
691691
const handleClickOrTouch = (e: MouseEvent | GestureEvent, preserveFocus: boolean): void => {
692692
tab.blur(); // prevent flicker of focus outline on tab until editor got focus
693693

694-
if (e instanceof MouseEvent && e.button !== 0) {
694+
if (e instanceof MouseEvent && (e.button !== 0 /* middle/right mouse button */ || (isMacintosh && e.ctrlKey /* macOS context menu */))) {
695695
if (e.button === 1) {
696696
e.preventDefault(); // required to prevent auto-scrolling (https://github.com/microsoft/vscode/issues/16690)
697697
}
698698

699-
return undefined; // only for left mouse click
699+
return undefined;
700700
}
701701

702702
if (this.originatesFromTabActionBar(e)) {

0 commit comments

Comments
 (0)