Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

topic_list: Ensure zoomed in selectors return 0 when not zoomed in.

Aman Agrawala12a916d37f2
diff --git a/web/src/topic_list.ts b/web/src/topic_list.ts
index a278e28a1d3..3ebb6e590de 100644
--- a/web/src/topic_list.ts
+++ b/web/src/topic_list.ts
@@ -453,13 +453,22 @@ export function left_sidebar_scroll_zoomed_in_topic_into_view(): void {
return;
}
const $container = $("#left_sidebar_scroll_container");
- const stream_header_height =
- $(".narrow-filter.stream-expanded .bottom_left_row").outerHeight(true) ?? 0;
- const topic_header_height = $("#topics_header").outerHeight(true) ?? 0;
+ let sticky_header_height = 0;
+ if (zoomed) {
+ const stream_header_height =
+ $(
+ "#streams_list.zoom-in .narrow-filter.stream-expanded > .bottom_left_row",
+ ).outerHeight(true) ?? 0;
+ const topic_header_height =
+ $("#streams_list.zoom-in #topics_header").outerHeight(true) ?? 0;
+ sticky_header_height += stream_header_height + topic_header_height;
+ }
const channel_folder_header_height =
- $selected_topic.closest(".stream-list-subsection-header").outerHeight(true) ?? 0;
- const sticky_header_height =
- stream_header_height + topic_header_height + channel_folder_header_height;
+ $selected_topic
+ .closest(".stream-list-section-container")
+ .find(".stream-list-subsection-header")
+ .outerHeight(true) ?? 0;
+ sticky_header_height += channel_folder_header_height;
scroll_util.scroll_element_into_container($selected_topic, $container, sticky_header_height);
}