Skip to content

Commit

Permalink
fix(react): respect ctrl/cmd keys
Browse files Browse the repository at this point in the history
do not prevent opening a new tab when clicking on a <Link> with ctrl/cmd key

fixes #13
  • Loading branch information
TimeRaider committed Nov 2, 2016
1 parent cbc8542 commit 1dee34a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions examples/src/components/App/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ const Main = ({children}) => {
);
};

const onClickCallback = e => {
e.preventDefault();
const onClickCallback = () => {
console.log('OnClick'); // eslint-disable-line no-console
};

Expand Down
2 changes: 1 addition & 1 deletion src/components/Link.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class Link extends BaseRouterComponent {
initiateLocationChange(e) {
const { target } = this.props;

if (!target && !this.href.protocol) {
if (!target && !this.href.protocol && e.which !== 2 && !e.metaKey && !e.ctrlKey) {
e.preventDefault();
this.locationChange(this.href);
}
Expand Down

0 comments on commit 1dee34a

Please sign in to comment.