From af6d35627978047724612c027e60cb0a89cb2eef Mon Sep 17 00:00:00 2001 From: ThibG Date: Tue, 12 May 2020 15:29:44 +0200 Subject: Fix first poll option not being focused when adding a poll (#13740) Fixes #13698 --- app/javascript/mastodon/features/compose/components/poll_form.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'app/javascript') diff --git a/app/javascript/mastodon/features/compose/components/poll_form.js b/app/javascript/mastodon/features/compose/components/poll_form.js index 2f37ce64b..db49f90eb 100644 --- a/app/javascript/mastodon/features/compose/components/poll_form.js +++ b/app/javascript/mastodon/features/compose/components/poll_form.js @@ -27,6 +27,7 @@ class Option extends React.PureComponent { title: PropTypes.string.isRequired, index: PropTypes.number.isRequired, isPollMultiple: PropTypes.bool, + autoFocus: PropTypes.bool, onChange: PropTypes.func.isRequired, onRemove: PropTypes.func.isRequired, onToggleMultiple: PropTypes.func.isRequired, @@ -71,7 +72,7 @@ class Option extends React.PureComponent { } render () { - const { isPollMultiple, title, index, intl } = this.props; + const { isPollMultiple, title, index, autoFocus, intl } = this.props; return (
  • @@ -96,6 +97,7 @@ class Option extends React.PureComponent { onSuggestionsClearRequested={this.onSuggestionsClearRequested} onSuggestionSelected={this.onSuggestionSelected} searchTokens={[':']} + autoFocus={autoFocus} /> @@ -146,10 +148,12 @@ class PollForm extends ImmutablePureComponent { return null; } + const autoFocusIndex = options.indexOf(''); + return (
      - {options.map((title, i) =>
    -- cgit