From 97c02f1c498dd37541aa104d4bd898f88ed697c0 Mon Sep 17 00:00:00 2001 From: Esa-Matti Suuronen Date: Fri, 25 Jul 2014 11:13:35 +0300 Subject: [PATCH] [fixed] middle click on Restore the de facto browser behavior for middle click on links: Open to background tab. closes #120 --- modules/components/Link.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/components/Link.js b/modules/components/Link.js index 2e86e264c9..8ff48d6b8b 100644 --- a/modules/components/Link.js +++ b/modules/components/Link.js @@ -109,7 +109,7 @@ var Link = React.createClass({ }, handleClick: function (event) { - if (isModifiedEvent(event)) + if (isModifiedEvent(event) || !isLeftClick(event)) return; event.preventDefault(); @@ -129,6 +129,10 @@ var Link = React.createClass({ }); +function isLeftClick(event) { + return event.button === 0; +} + function isModifiedEvent(event) { return !!(event.metaKey || event.ctrlKey || event.shiftKey); }