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 7, 2016
1 parent f35eed0 commit 5294c26
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
@@ -1,4 +1,5 @@
import React, {Component, PropTypes} from 'react';
import ReactDOM from 'react-dom';
import {createChildFragment} from '../utils/childUtils';
import Events from '../utils/events';
import keycode from 'keycode';
Expand Down Expand Up @@ -94,6 +95,10 @@ class EnhancedButton extends Component {
componentDidMount() {
injectStyle();
listenForTabPresses();
if (this.state.isKeyboardFocused) {
ReactDOM.findDOMNode(this).focus();
this.props.onKeyboardFocus(null, true);
}
}

componentWillReceiveProps(nextProps) {
Expand Down

0 comments on commit 5294c26

Please sign in to comment.