Skip to content

Commit 12f9766

Browse files
committed
fix: right clicks on tab bar sometimes opens up editor's context menu
1 parent 96ba960 commit 12f9766

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/command/DefaultMenus.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,10 @@ define(function (require, exports, module) {
407407
* an existing selection
408408
*/
409409
$("#editor-holder").on("contextmenu", function (e) {
410+
// make sure that the click was not made inside a tab bar container
411+
// if it is, then we don't show editor context menu as tab bar has its own
412+
if($(e.target).closest('.tab-bar-container').length) { return; }
413+
410414
require(["editor/EditorManager"], function (EditorManager) {
411415
if ($(e.target).parents(".CodeMirror-gutter").length !== 0) {
412416
return;
@@ -477,4 +481,4 @@ define(function (require, exports, module) {
477481
Menus.getContextMenu(Menus.ContextMenuIds.WORKING_SET_CONTEXT_MENU).on("beforeContextMenuOpen", _setMenuItemsVisible);
478482
Menus.getContextMenu(Menus.ContextMenuIds.PROJECT_MENU).on("beforeContextMenuOpen", _setMenuItemsVisible);
479483
});
480-
});
484+
});

src/extensionsIntegrated/TabBar/main.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,9 @@ define(function (require, exports, module) {
511511

512512
// delegate event handling for both tab bars
513513
$(document).on("mousedown", ".phoenix-tab-bar .tab", function (event) {
514+
// to prevent right clicks activate the mousedown event
515+
if (event.button === 2) { return; }
516+
514517
if ($(event.target).hasClass("fa-times") || $(event.target).closest(".tab-close").length) {
515518
return;
516519
}

0 commit comments

Comments
 (0)