condense: Focus on the message after condensing/expanding it.

This commit is contained in:
Daniil Fadeev 2023-08-08 11:44:35 +03:00 committed by Tim Abbott
parent 225be0bb97
commit 28ba839857
1 changed files with 8 additions and 2 deletions

View File

@ -258,7 +258,10 @@ export function initialize() {
// Expanding a message can mean either uncollapsing or
// uncondensing it.
const $row = $(this).closest(".message_row");
const message = message_lists.current.get(rows.id($row));
const id = rows.id($row);
const message = message_lists.current.get(id);
// Focus on the expanded message.
message_lists.current.select_id(id);
const $content = $row.find(".message_content");
if (message.collapsed) {
// Uncollapse.
@ -276,7 +279,10 @@ export function initialize() {
$("#message_feed_container").on("click", ".message_condenser", function (e) {
const $row = $(this).closest(".message_row");
message_lists.current.get(rows.id($row)).condensed = true;
const id = rows.id($row);
// Focus on the condensed message.
message_lists.current.select_id(id);
message_lists.current.get(id).condensed = true;
condense_row($row);
e.stopPropagation();
e.preventDefault();