stream_list: Scroll selected topic into view when zoomed in.

This is useful for keyboard users when use `n` to navigate to the
next topic with zoomed in topic list.
This commit is contained in:
Aman Agrawal
2025-01-23 15:27:13 +05:30
committed by Tim Abbott
parent a5e2a7b4e4
commit 3d6baaf450
2 changed files with 5 additions and 1 deletions

View File

@@ -780,6 +780,10 @@ export function handle_narrow_activated(
} }
} }
} }
if (is_zoomed_in()) {
topic_list.scroll_zoomed_in_topic_into_view();
}
} }
export function handle_message_view_deactivated(): void { export function handle_message_view_deactivated(): void {

View File

@@ -282,7 +282,7 @@ export function rebuild($stream_li: JQuery, stream_id: number): void {
active_widgets.set(stream_id, widget); active_widgets.set(stream_id, widget);
} }
function scroll_zoomed_in_topic_into_view(): void { export function scroll_zoomed_in_topic_into_view(): void {
const $selected_topic = $(".topic-list .topic-list-item.active-sub-filter"); const $selected_topic = $(".topic-list .topic-list-item.active-sub-filter");
if ($selected_topic.length === 0) { if ($selected_topic.length === 0) {
// If we don't have a selected topic, scroll to top. // If we don't have a selected topic, scroll to top.