compose: Stop selecting compose box content after topic change.

Previously, the on_topic_change handler for the compose system would
focus the compose box after a topic change, and also select all content in 
the compose box. Selecting that content makes sense if we think the user's
intent is likely to be deleting that content; but there's no clear reason we
should expect that intent, and it's not particularly consistent with our drafts
model to risk accidentally losing partially composed message content this way.

After some discussion, we've concluded that in both cases reaching this code path
(either the previous topic being "" or the compose box content being entry), it'd
be better to skip the `.select()`.

Fixes #23146.
This commit is contained in:
Joseph Ho
2022-10-18 20:20:52 -04:00
committed by GitHub
parent 8089910dcb
commit 551c6899be

View File

@@ -521,7 +521,7 @@ export function on_topic_narrow() {
compose_validate.warn_if_topic_resolved(true);
compose_fade.set_focused_recipient("stream");
compose_fade.update_message_list();
$("#compose-textarea").trigger("focus").trigger("select");
$("#compose-textarea").trigger("focus");
}
export function quote_and_reply(opts) {