about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorunarist <m.unarist@gmail.com>2017-06-01 11:20:10 +0900
committerEugen Rochko <eugen@zeonfederated.com>2017-06-01 04:20:10 +0200
commitdbccdcc1b1e295b7f05a7867936e858ea26f0d6b (patch)
tree7f775f779620a3f5d9023070f3799bd312fd88a2 /app
parent5c6352397257d82e75b90cc5e7de1a3922bde7bd (diff)
Focus the submit button on the boost modal (#3494)
Focus the submit button when boost modal is opened.
Diffstat (limited to 'app')
-rw-r--r--app/javascript/mastodon/features/ui/components/boost_modal.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/app/javascript/mastodon/features/ui/components/boost_modal.js b/app/javascript/mastodon/features/ui/components/boost_modal.js
index 183f05fab..9d99b5336 100644
--- a/app/javascript/mastodon/features/ui/components/boost_modal.js
+++ b/app/javascript/mastodon/features/ui/components/boost_modal.js
@@ -27,6 +27,10 @@ class BoostModal extends ImmutablePureComponent {
     intl: PropTypes.object.isRequired,
   };
 
+  componentDidMount() {
+    this.button.focus();
+  }
+
   handleReblog = () => {
     this.props.onReblog(this.props.status);
     this.props.onClose();
@@ -40,6 +44,10 @@ class BoostModal extends ImmutablePureComponent {
     }
   }
 
+  setRef = (c) => {
+    this.button = c;
+  }
+
   render () {
     const { status, intl, onClose } = this.props;
 
@@ -67,7 +75,7 @@ class BoostModal extends ImmutablePureComponent {
 
         <div className='boost-modal__action-bar'>
           <div><FormattedMessage id='boost_modal.combo' defaultMessage='You can press {combo} to skip this next time' values={{ combo: <span>Shift + <i className='fa fa-retweet' /></span> }} /></div>
-          <Button text={intl.formatMessage(messages.reblog)} onClick={this.handleReblog} />
+          <Button text={intl.formatMessage(messages.reblog)} onClick={this.handleReblog} ref={this.setRef} />
         </div>
       </div>
     );