From 9784f8b562f6592e9d9190ca29d2b2e870006d10 Mon Sep 17 00:00:00 2001 From: noellabo Date: Thu, 13 Aug 2020 21:52:07 +0900 Subject: [PATCH] Add focus setting when opening the circle column --- .../features/circles/components/new_circle_form.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/javascript/mastodon/features/circles/components/new_circle_form.js b/app/javascript/mastodon/features/circles/components/new_circle_form.js index 23232d087f2f9d..fe41d4c7427f54 100644 --- a/app/javascript/mastodon/features/circles/components/new_circle_form.js +++ b/app/javascript/mastodon/features/circles/components/new_circle_form.js @@ -32,6 +32,10 @@ class NewCircleForm extends React.PureComponent { onSubmit: PropTypes.func.isRequired, }; + componentDidMount() { + this.input.focus(); + } + handleChange = e => { this.props.onChange(e.target.value); } @@ -45,6 +49,10 @@ class NewCircleForm extends React.PureComponent { this.props.onSubmit(); } + setRef = (c) => { + this.input = c; + } + render () { const { value, disabled, intl } = this.props; @@ -62,6 +70,7 @@ class NewCircleForm extends React.PureComponent { disabled={disabled} onChange={this.handleChange} placeholder={label} + ref={this.setRef} />