aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Header.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/Header.jsx')
-rw-r--r--src/Header.jsx12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/Header.jsx b/src/Header.jsx
index f6dd241..1520d25 100644
--- a/src/Header.jsx
+++ b/src/Header.jsx
@@ -22,6 +22,7 @@ class Header extends Component {
22 allowEmpty: PropTypes.bool, 22 allowEmpty: PropTypes.bool,
23 defaultOpenValue: PropTypes.object, 23 defaultOpenValue: PropTypes.object,
24 currentSelectPanel: PropTypes.string, 24 currentSelectPanel: PropTypes.string,
25 focusOnOpen: PropTypes.bool,
25 onKeyDown: PropTypes.func, 26 onKeyDown: PropTypes.func,
26 }; 27 };
27 28
@@ -34,6 +35,17 @@ class Header extends Component {
34 }; 35 };
35 } 36 }
36 37
38 componentDidMount() {
39 if (this.props.focusOnOpen) {
40 // Wait one frame for the panel to be positioned before focusing
41 const requestAnimationFrame = (window.requestAnimationFrame || window.setTimeout);
42 requestAnimationFrame(() => {
43 this.refs.input.focus();
44 this.refs.input.select();
45 });
46 }
47 }
48
37 componentWillReceiveProps(nextProps) { 49 componentWillReceiveProps(nextProps) {
38 const { value, format } = nextProps; 50 const { value, format } = nextProps;
39 this.setState({ 51 this.setState({