Project: jirasoftware
Issue JSW-5341: Plan|Work|Report links should support opening in another tab with middle click (cmd click)
If I middle click them or Ctrl click them, they should do nothing and fallthrough to the native browser handling. We have code for this in Stash, but since we only use it with live events, we don't handle checking for left click (we probably should): EDIT: Here's with which checking as well. {code} exports.openInSameTab = function (e) { return (e.which == null || e.which === 1) && !(e.metaKey || e.ctrlKey || e.shiftKey || (e.altKey && !$.browser.msie)); }; {code} Called like {code} $(document).on('click', 'a', function(e) { if (!openInSameTab(e)) return; ... do stuff ... e.preventDefault(); }); {code} If you want to handle left click only, I believe you can check e.which === 1, but you should test that first.
Story points: 3