From c4344f8c02227f77165f4592e0c87c323b7e00f5 Mon Sep 17 00:00:00 2001 From: hmhealey Date: Thu, 4 Feb 2016 15:07:06 -0500 Subject: Added focus to the sidebar textbox when it is opened --- web/react/components/create_comment.jsx | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'web/react') diff --git a/web/react/components/create_comment.jsx b/web/react/components/create_comment.jsx index 797b98ce2..9e7c67515 100644 --- a/web/react/components/create_comment.jsx +++ b/web/react/components/create_comment.jsx @@ -75,6 +75,8 @@ class CreateComment extends React.Component { componentDidMount() { PreferenceStore.addChangeListener(this.onPreferenceChange); window.addEventListener('resize', this.handleResize); + + this.refs.textbox.focus(); } componentWillUnmount() { PreferenceStore.removeChangeListener(this.onPreferenceChange); @@ -95,6 +97,10 @@ class CreateComment extends React.Component { $('.post-right__scroll').perfectScrollbar('update'); } } + + if (prevProps.rootId !== this.props.rootId) { + this.refs.textbox.focus(); + } } handleSubmit(e) { e.preventDefault(); -- cgit v1.2.3-1-g7c22