Skip to content

Commit

Permalink
Web: Ctrl-click on tab should open context menu but not open tab (#16…
Browse files Browse the repository at this point in the history
…5894) (#165895)

Web: Ctrl-click on tab should open context menu but not open tab (fix #165894)
  • Loading branch information
bpasero committed Nov 9, 2022
1 parent 6187978 commit 9dabc13
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/vs/workbench/browser/parts/editor/editorGroupView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,8 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
const handleTitleClickOrTouch = (e: MouseEvent | GestureEvent): void => {
let target: HTMLElement;
if (e instanceof MouseEvent) {
if (e.button !== 0 || (isMacintosh && e.ctrlKey)) {
return undefined; // only for left mouse click (ctrl+click on macos is right-click)
if (e.button !== 0 /* middle/right mouse button */ || (isMacintosh && e.ctrlKey /* macOS context menu */)) {
return undefined;
}

target = e.target as HTMLElement;
Expand Down
4 changes: 2 additions & 2 deletions src/vs/workbench/browser/parts/editor/tabsTitleControl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -691,12 +691,12 @@ export class TabsTitleControl extends TitleControl {
const handleClickOrTouch = (e: MouseEvent | GestureEvent, preserveFocus: boolean): void => {
tab.blur(); // prevent flicker of focus outline on tab until editor got focus

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

return undefined; // only for left mouse click
return undefined;
}

if (this.originatesFromTabActionBar(e)) {
Expand Down

0 comments on commit 9dabc13

Please sign in to comment.