Skip to content

Commit

Permalink
Merge pull request #4122 from ryantemple/enhanced-button-focus
Browse files Browse the repository at this point in the history
[EnhancedButton] Fix not setting focus when keyboardFocused prop set
  • Loading branch information
oliviertassinari committed May 13, 2016
2 parents 9d20ad3 + 88ffe5d commit 416a42c
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 @@ -106,6 +106,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 @@ -323,6 +327,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 416a42c

Please sign in to comment.