Skip to content

Commit 97c02f1

Browse files
esamattisryanflorence
authored andcommitted
[fixed] middle click on <Link/>
Restore the de facto browser behavior for middle click on links: Open to background tab. closes #120
1 parent 4a94519 commit 97c02f1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

modules/components/Link.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ var Link = React.createClass({
109109
},
110110

111111
handleClick: function (event) {
112-
if (isModifiedEvent(event))
112+
if (isModifiedEvent(event) || !isLeftClick(event))
113113
return;
114114

115115
event.preventDefault();
@@ -129,6 +129,10 @@ var Link = React.createClass({
129129

130130
});
131131

132+
function isLeftClick(event) {
133+
return event.button === 0;
134+
}
135+
132136
function isModifiedEvent(event) {
133137
return !!(event.metaKey || event.ctrlKey || event.shiftKey);
134138
}

0 commit comments

Comments
 (0)