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: Reduce stream header's height when scrolling elt into view.

Aman Agrawal45f35a464e84
diff --git a/frontend_tests/node_tests/stream_list.js b/frontend_tests/node_tests/stream_list.js
index 905d4e41426..3c81b39a14e 100644
--- a/frontend_tests/node_tests/stream_list.js
+++ b/frontend_tests/node_tests/stream_list.js
@@ -409,6 +409,7 @@ test_ui("narrowing", ({mock_template}) => {
topic_list.rebuild = noop;
topic_list.active_stream_id = noop;
topic_list.get_stream_li = noop;
+ $("#streams_header").outerHeight = () => 0;
assert.ok(!$("<devel-sidebar-row-stub>").hasClass("active-filter"));
@@ -700,6 +701,7 @@ test_ui("refresh_pin", ({override, override_rewire, mock_template}) => {
override_rewire(stream_list, "update_count_in_dom", noop);
$("#stream_filters").append = noop;
+ $("#streams_header").outerHeight = () => 0;
let scrolled;
override(scroll_util, "scroll_element_into_container", ($li) => {
diff --git a/static/js/stream_list.js b/static/js/stream_list.js
index 2fc55b76564..cbf55cd3032 100644
--- a/static/js/stream_list.js
+++ b/static/js/stream_list.js
@@ -753,8 +753,8 @@ export function scroll_stream_into_view($stream_li) {
blueslip.error("Invalid stream_li was passed in");
return;
}
-
- scroll_util.scroll_element_into_container($stream_li, $container);
+ const stream_header_height = $("#streams_header").outerHeight();
+ scroll_util.scroll_element_into_container($stream_li, $container, stream_header_height);
}
export function maybe_scroll_narrow_into_view() {