From 6428039463f5f74253c06c188692900bae15b527 Mon Sep 17 00:00:00 2001 From: Thomas Brouard Date: Wed, 2 Nov 2016 17:56:16 +0100 Subject: [PATCH] Activate on mousedown (dragula compatibility) --- index.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 7778402..7e736df 100644 --- a/index.js +++ b/index.js @@ -266,15 +266,22 @@ const TabPrivate = { }, initTabClickHandler: function () { + // Click const tabClickHandler = function (e) { if (this.isClosed) return; - if (e.which === 1) { - this.activate(); - } else if (e.which === 2) { + if (e.which === 2) { this.close(); } }; this.tab.addEventListener("click", tabClickHandler.bind(this), false); + // Mouse down + const tabMouseDownHandler = function (e) { + if (this.isClosed) return; + if (e.which === 1) { + this.activate(); + } + }; + this.tab.addEventListener("mousedown", tabMouseDownHandler.bind(this), false); }, initWebview: function () {