Skip to content

Commit 6b812b2

Browse files
committed
Merge pull request #118 from burnoutberni/middle-click-close
Close tabs with mouse middle click
2 parents 551cde0 + 9f48e50 commit 6b812b2

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

js/navbar/navbarTabs.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -260,10 +260,9 @@ function createTabElement(data) {
260260

261261
//click to enter edit mode or switch to a tab
262262
tabEl.addEventListener("click", function (e) {
263-
var tabId = this.getAttribute("data-tab");
264-
265-
//if the tab isn't focused
266-
if (tabs.getSelected() != data.id) {
263+
if (e.which == 2) { // if mouse middle click -> close tab
264+
closeTab(data.id);
265+
} else if (tabs.getSelected() != data.id) { // else switch to tab if it isn't focused
267266
switchToTab(data.id);
268267
} else { //the tab is focused, edit tab instead
269268
enterEditMode(data.id);

0 commit comments

Comments
 (0)