diff --git a/lib/components/Tabs.js b/lib/components/Tabs.js index ad99d53fbe..9c83726865 100644 --- a/lib/components/Tabs.js +++ b/lib/components/Tabs.js @@ -117,13 +117,18 @@ module.exports = React.createClass({ // Keep reference to last index for event handler const last = this.state.selectedIndex; - // Update selected index - this.setState({ selectedIndex: index, focus: focus === true }); + // Check wether change event handler cancels the tab change + let cancel = false; // Call change event handler if (typeof this.props.onSelect === 'function') { - this.props.onSelect(index, last); + cancel = (this.props.onSelect(index, last) === false); } + + if (!cancel) { + // Update selected index + this.setState({ selectedIndex: index, focus: focus === true }); + } }, getNextTab(index) {