message_scroll: Show scroll to bottom button.

Show/hide scroll to bottom button when the last message is
not visible in the current scroll position.

We adjust the bottom offset of the button based on compose box
height.

Fixes #19862
This commit is contained in:
Aman Agrawal
2022-02-14 16:43:32 +00:00
committed by Tim Abbott
parent ea07b6440c
commit 0eafa6039b
12 changed files with 145 additions and 2 deletions

View File

@@ -413,6 +413,13 @@ export function initialize() {
resize.watch_manual_resize("#compose-textarea");
// Update position of scroll to bottom button based on
// height of the compose box.
const update_scroll_to_bottom_position = new ResizeObserver(() => {
$("#scroll-to-bottom-button-container").css("bottom", $("#compose").outerHeight());
});
update_scroll_to_bottom_position.observe(document.querySelector("#compose"));
upload.feature_check($("#compose .compose_upload_file"));
$("#compose-all-everyone").on("click", ".compose-all-everyone-confirm", (event) => {