narrow: Save blue box position and restore on navigation.

This saves the blue box position as state on the location
in brower history, with `history.replaceState`.

The position is restored when a narrow is activated.

Fixes #20066.
This commit is contained in:
evykassirer
2023-08-08 14:59:25 -07:00
committed by Tim Abbott
parent 5a8416ff6a
commit 78f0dca269
6 changed files with 57 additions and 0 deletions

View File

@@ -58,6 +58,7 @@ import * as message_view_header from "./message_view_header";
import * as message_viewport from "./message_viewport";
import * as muted_users from "./muted_users";
import * as narrow from "./narrow";
import * as narrow_history from "./narrow_history";
import * as narrow_state from "./narrow_state";
import * as navbar_alerts from "./navbar_alerts";
import * as navigate from "./navigate";
@@ -400,6 +401,7 @@ export function initialize_kitchen_sink_stuff() {
const $row = event.msg_list.get_row(event.id);
$(".selected_message").removeClass("selected_message");
$row.addClass("selected_message");
narrow_history.save_narrow_state();
if (event.then_scroll) {
if ($row.length === 0) {