Skip to content

Commit

Permalink
compose: Focus message input on quote-and-reply
Browse files Browse the repository at this point in the history
Note that we have logic in `handleMessageFocus` to respond to focus
on the message input by auto-focusing the *topic* input in some
cases. That would be annoying if it happened here: you do a
quote-and-reply, and suddenly the topic input is focused?(!)

But that topic auto-focusing should be defeated in all cases where
it was active. In particular, since the previous commit, the topic
input won't be empty; the logic in `handleMessageFocus` will see
that and skip the auto-focus.

Fixes: #5718
  • Loading branch information
chrisbobbe committed Sep 13, 2023
1 parent be01d4b commit e7d3d81
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/compose/ComposeBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,7 @@ const ComposeBox: React$AbstractComponent<Props, ImperativeHandle> = forwardRef(
_,
});
setMessageInputValue(state => state.value.replace(quotingPlaceholder, quoteAndReplyText));
messageInputRef.current?.focus();
} finally {
setActiveQuoteAndRepliesCount(v => v - 1);
activeInvocations.current = activeInvocations.current.filter(x => x !== serialNumber);
Expand All @@ -464,6 +465,7 @@ const ComposeBox: React$AbstractComponent<Props, ImperativeHandle> = forwardRef(
topicSelectionAllowed,
topicInputState.value,
setTopicInputValue,
messageInputRef,
],
);
useImperativeHandle(ref, () => ({ doQuoteAndReply }), [doQuoteAndReply]);
Expand Down

0 comments on commit e7d3d81

Please sign in to comment.