From eebcb065b1ee1b68572de812486ae48f83670baf Mon Sep 17 00:00:00 2001 From: Chris Bobbe Date: Tue, 25 Apr 2023 13:59:01 -0700 Subject: [PATCH] compose: Focus message input on quote-and-reply 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 --- src/compose/ComposeBox.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/compose/ComposeBox.js b/src/compose/ComposeBox.js index 40e8416e394..23bc6d19e61 100644 --- a/src/compose/ComposeBox.js +++ b/src/compose/ComposeBox.js @@ -449,6 +449,7 @@ const ComposeBox: React$AbstractComponent = forwardRef( } finally { setActiveQuoteAndRepliesCount(v => v - 1); activeInvocations.current = activeInvocations.current.filter(x => x !== serialNumber); + messageInputRef.current?.focus(); } }, [ @@ -462,6 +463,7 @@ const ComposeBox: React$AbstractComponent = forwardRef( topicSelectionAllowed, topicInputState.value, setTopicInputValue, + messageInputRef, ], ); useImperativeHandle(ref, () => ({ doQuoteAndReply }), [doQuoteAndReply]);