From 5f7ce2214a9fd91a0ab62312674f5cffd811f8ca Mon Sep 17 00:00:00 2001
From: Harrison Healey <harrisonmhealey@gmail.com>
Date: Wed, 1 Jun 2016 08:52:28 -0400
Subject: Improved internal links which use react-router (#3180)

---
 webapp/utils/text_formatting.jsx | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

(limited to 'webapp/utils/text_formatting.jsx')

diff --git a/webapp/utils/text_formatting.jsx b/webapp/utils/text_formatting.jsx
index 21bfe5333..cc4a24d19 100644
--- a/webapp/utils/text_formatting.jsx
+++ b/webapp/utils/text_formatting.jsx
@@ -450,7 +450,13 @@ export function handleClick(e) {
     } else if (hashtagAttribute) {
         Utils.searchForTerm(hashtagAttribute.value);
     } else if (linkAttribute) {
-        browserHistory.push(linkAttribute.value);
+        const MIDDLE_MOUSE_BUTTON = 1;
+
+        if (!(e.button === MIDDLE_MOUSE_BUTTON || e.altKey || e.ctrlKey || e.metaKey || e.shiftKey)) {
+            e.preventDefault();
+
+            browserHistory.push(linkAttribute.value);
+        }
     }
 }
 
-- 
cgit v1.2.3-1-g7c22

