Skip to content

Commit

Permalink
[EnhancedButton] Fix not setting focus when keyboardFocused prop set
Browse files Browse the repository at this point in the history
  • Loading branch information
ryantemple committed May 10, 2016
1 parent f35eed0 commit 88ffe5d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/internal/EnhancedButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ class EnhancedButton extends Component {
componentDidMount() {
injectStyle();
listenForTabPresses();
if (this.state.isKeyboardFocused) {
this.refs.enhancedButton.focus();
this.props.onKeyboardFocus(null, true);
}
}

componentWillReceiveProps(nextProps) {
Expand Down Expand Up @@ -304,6 +308,7 @@ class EnhancedButton extends Component {
const buttonProps = {
...other,
style: prepareStyles(mergedStyles),
ref: 'enhancedButton',
disabled: disabled,
onBlur: this.handleBlur,
onClick: this.handleClick,
Expand Down

0 comments on commit 88ffe5d

Please sign in to comment.