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: zulip#5718
  • Loading branch information
chrisbobbe committed Apr 27, 2023
1 parent f2faf44 commit eebcb06
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 @@ -449,6 +449,7 @@ const ComposeBox: React$AbstractComponent<Props, ImperativeHandle> = forwardRef(
} finally {
setActiveQuoteAndRepliesCount(v => v - 1);
activeInvocations.current = activeInvocations.current.filter(x => x !== serialNumber);
messageInputRef.current?.focus();
}
},
[
Expand All @@ -462,6 +463,7 @@ const ComposeBox: React$AbstractComponent<Props, ImperativeHandle> = forwardRef(
topicSelectionAllowed,
topicInputState.value,
setTopicInputValue,
messageInputRef,
],
);
useImperativeHandle(ref, () => ({ doQuoteAndReply }), [doQuoteAndReply]);
Expand Down

0 comments on commit eebcb06

Please sign in to comment.