diff --git a/app/lib/components/tab.js b/app/lib/components/tab.js index 3924a5d5..1c4050fa 100644 --- a/app/lib/components/tab.js +++ b/app/lib/components/tab.js @@ -6,6 +6,7 @@ export default class Tab extends Component { super(); this.hover = this.hover.bind(this); this.blur = this.blur.bind(this); + this.handleClick = this.handleClick.bind(this); this.state = { hovered: false }; @@ -19,6 +20,17 @@ export default class Tab extends Component { this.setState({ hovered: false }); } + handleClick (event) { + const isLeftClick = event.nativeEvent.which === 1; + const isMiddleClick = event.nativeEvent.which === 2; + + if (isLeftClick) { + this.props.isActive ? null : this.props.onSelect(); + } else if (isMiddleClick) { + this.props.onClose(); + } + } + template (css) { const { isActive, isFirst, isLast, borderColor, hasActivity } = this.props; const { hovered } = this.state; @@ -41,7 +53,7 @@ export default class Tab extends Component { isLast && 'textLast', isActive && 'textActive' ) } - onClick={ this.props.isActive ? null : this.props.onSelect }> + onClick={ this.handleClick }> { this.props.text }