Don’t handle click with modifier keys. (#10)

This commit is contained in:
Andrej Badin
2017-01-27 03:08:27 +01:00
parent ddefb2fc7d
commit 0791ab7398

View File

@@ -1,5 +1,8 @@
import React, { PropTypes, Component } from 'react';
const isModifiedEvent = (event) =>
!!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
const Linkable = (Inner) => {
class LinkableWrapped extends Component {
render() {
@@ -29,7 +32,7 @@ const Linkable = (Inner) => {
}
onClick = e => {
const action = this.getAction();
if (action) {
if (!isModifiedEvent(e) && action) {
this.context.dispatch(action);
e.preventDefault();
}