message_scroll: Hide scroll to bottom button when using keypress.

We added  `is_keypress_scrolling` flag in `message_scroll.js` to keep
track of if keypress is used for scrolling.

Fixes #21844.
This commit is contained in:
Riken Shah
2022-07-05 06:38:13 +00:00
committed by Tim Abbott
parent 3ba89e7779
commit 5fdd93cf32
2 changed files with 22 additions and 1 deletions

View File

@@ -25,6 +25,13 @@ export function suppress_selection_update_on_next_scroll() {
update_selection_on_next_scroll = false;
}
// Whether a keyboard shortcut is triggering a message feed scroll event.
let keyboard_triggered_current_scroll = false;
export function mark_keyboard_triggered_current_scroll() {
keyboard_triggered_current_scroll = true;
}
let loading_older_messages_indicator_showing = false;
let loading_newer_messages_indicator_showing = false;
@@ -217,7 +224,14 @@ export function scroll_finished() {
let scroll_timer;
function scroll_finish() {
actively_scrolling = true;
show_scroll_to_bottom_button();
// Don't present the "scroll to bottom" widget if the current
// scroll was triggered by the keyboard.
if (!keyboard_triggered_current_scroll) {
show_scroll_to_bottom_button();
}
keyboard_triggered_current_scroll = false;
clearTimeout(scroll_timer);
scroll_timer = setTimeout(scroll_finished, 100);
}