diff options
author | Kushal Pandya <kushal@gitlab.com> | 2017-02-07 19:10:14 +0300 |
---|---|---|
committer | Kushal Pandya <kushal@gitlab.com> | 2017-02-07 19:10:14 +0300 |
commit | a11b23046fc95fa30c6eb3d3cdb2fb994e1fbe92 (patch) | |
tree | f997c1ba7dbb9ced0548456bc00722698958a392 /app | |
parent | 936f463bafcbe846f231f14ae29db20a920b1ca8 (diff) |
Use `gl.utils.isMetaClick` to identify meta-clicks
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/merge_request_tabs.js.es6 | 6 | ||||
-rw-r--r-- | app/assets/javascripts/todos.js.es6 | 6 |
2 files changed, 2 insertions, 10 deletions
diff --git a/app/assets/javascripts/merge_request_tabs.js.es6 b/app/assets/javascripts/merge_request_tabs.js.es6 index 43ba94ada9b..186cb3e9190 100644 --- a/app/assets/javascripts/merge_request_tabs.js.es6 +++ b/app/assets/javascripts/merge_request_tabs.js.es6 @@ -104,11 +104,7 @@ require('./flash'); clickTab(e) { if (e.target) { const targetLink = e.target.getAttribute('href'); - // Allow following special clicks to make link open in new tab - // 1) Cmd + Click on Mac (e.metaKey) - // 2) Ctrl + Click on PC (e.ctrlKey) - // 3) Middle-click or Mouse Wheel Click (e.which is 2) - if (e.metaKey || e.ctrlKey || e.which === 2) { + if (gl.utils.isMetaClick(e)) { e.stopImmediatePropagation(); window.open(targetLink, '_blank'); } diff --git a/app/assets/javascripts/todos.js.es6 b/app/assets/javascripts/todos.js.es6 index 5b1b585dfac..b07e62a8c30 100644 --- a/app/assets/javascripts/todos.js.es6 +++ b/app/assets/javascripts/todos.js.es6 @@ -157,11 +157,7 @@ return; } - // Allow following special clicks to make link open in new tab - // 1) Cmd + Click on Mac (e.metaKey) - // 2) Ctrl + Click on PC (e.ctrlKey) - // 3) Middle-click or Mouse Wheel Click (e.which is 2) - if (e.metaKey || e.ctrlKey || e.which === 2) { + if (gl.utils.isMetaClick(e)) { e.preventDefault(); // Meta-Click on username leads to different URL than todoLink. // Turbolinks can resolve that URL, but window.open requires URL manually. |