Use gl.utils.isMetaClick to identify meta-clicks

This commit is contained in:
Kushal Pandya 2017-02-07 21:40:14 +05:30
parent 936f463baf
commit a11b23046f
2 changed files with 2 additions and 10 deletions

View file

@ -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');
}

View file

@ -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.