From 88ffe5d7673eb9bd35d006709d7691073ed37d77 Mon Sep 17 00:00:00 2001 From: Ryan Temple Date: Tue, 10 May 2016 19:56:59 +0100 Subject: [PATCH] [EnhancedButton] Fix not setting focus when keyboardFocused prop set --- src/internal/EnhancedButton.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/internal/EnhancedButton.js b/src/internal/EnhancedButton.js index 6c277693dbfade..d222fd1fdaef7d 100644 --- a/src/internal/EnhancedButton.js +++ b/src/internal/EnhancedButton.js @@ -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) { @@ -304,6 +308,7 @@ class EnhancedButton extends Component { const buttonProps = { ...other, style: prepareStyles(mergedStyles), + ref: 'enhancedButton', disabled: disabled, onBlur: this.handleBlur, onClick: this.handleClick,