stream_list: Reduce stream header's height when scrolling elt into view.

Since stream header is now sticky, we need to reduce it's height
when calculation position of the element we want to scroll into view
so that it doesn't hide under the sticky header.
This commit is contained in:
Aman Agrawal 2022-10-05 07:43:57 +00:00 committed by Tim Abbott
parent fc70921eeb
commit 45f35a464e
2 changed files with 4 additions and 2 deletions

View File

@ -409,6 +409,7 @@ test_ui("narrowing", ({mock_template}) => {
topic_list.rebuild = noop; topic_list.rebuild = noop;
topic_list.active_stream_id = noop; topic_list.active_stream_id = noop;
topic_list.get_stream_li = noop; topic_list.get_stream_li = noop;
$("#streams_header").outerHeight = () => 0;
assert.ok(!$("<devel-sidebar-row-stub>").hasClass("active-filter")); 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); override_rewire(stream_list, "update_count_in_dom", noop);
$("#stream_filters").append = noop; $("#stream_filters").append = noop;
$("#streams_header").outerHeight = () => 0;
let scrolled; let scrolled;
override(scroll_util, "scroll_element_into_container", ($li) => { override(scroll_util, "scroll_element_into_container", ($li) => {

View File

@ -753,8 +753,8 @@ export function scroll_stream_into_view($stream_li) {
blueslip.error("Invalid stream_li was passed in"); blueslip.error("Invalid stream_li was passed in");
return; return;
} }
const stream_header_height = $("#streams_header").outerHeight();
scroll_util.scroll_element_into_container($stream_li, $container); scroll_util.scroll_element_into_container($stream_li, $container, stream_header_height);
} }
export function maybe_scroll_narrow_into_view() { export function maybe_scroll_narrow_into_view() {