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.

stream_list: Fix narrowed channel moved out of view.

Aman Agrawal593a3ae034fa
diff --git a/web/src/stream_list.ts b/web/src/stream_list.ts
index 96080dc8cf2..f984c8221e6 100644
--- a/web/src/stream_list.ts
+++ b/web/src/stream_list.ts
@@ -1471,15 +1471,16 @@ export let scroll_stream_into_view = function ($stream_li: JQuery): void {
blueslip.error("Invalid stream_li was passed in");
return;
}
- const header_height = $stream_li
- .closest(".stream-list-section-container")
- .children(".stream-list-subsection-header")
- .outerHeight()!;
- scroll_util.scroll_element_into_container(
- $stream_li,
- $container,
- header_height,
- );
+
+ // Get the element with the channel name which we want to
+ // be visible.
+ const $stream_header = $stream_li.find(".subscription_block");
+ const header_height =
+ $stream_li
+ .closest(".stream-list-section-container")
+ .children(".stream-list-subsection-header")
+ .outerHeight()! + 2; // + 2px for top border
+ scroll_util.scroll_element_into_container($stream_header, $container, header_height);
// Note: If the stream is in a collapsed folder, we don't uncollapse
// the folder. We do uncollapse when the user clicks on the channel,
// but that's handled elsewhere.