Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
message_scroll: Hide scroll to bottom button when using keypress.
Riken Shah5fdd93cf32ca
diff --git a/static/js/hotkey.js b/static/js/hotkey.jsindex b588fe79a50..7a8f7a6030e 100644--- a/static/js/hotkey.js+++ b/static/js/hotkey.js@@ -22,6 +22,7 @@ import * as list_util from "./list_util";import * as message_edit from "./message_edit";import * as message_flags from "./message_flags";import * as message_lists from "./message_lists";+import * as message_scroll from "./message_scroll";import * as message_view_header from "./message_view_header";import * as muted_topics_ui from "./muted_topics_ui";import * as narrow from "./narrow";@@ -840,27 +841,33 @@ export function process_hotkey(e, hotkey) {switch (event_name) {case "down_arrow":case "vim_down":+ message_scroll.mark_keyboard_triggered_current_scroll();navigate.down(true); // with_centeringreturn true;case "up_arrow":case "vim_up":+ message_scroll.mark_keyboard_triggered_current_scroll();navigate.up();return true;case "home":+ message_scroll.mark_keyboard_triggered_current_scroll();navigate.to_home();return true;case "end":case "G_end":+ message_scroll.mark_keyboard_triggered_current_scroll();navigate.to_end();return true;case "page_up":case "vim_page_up":case "shift_spacebar":+ message_scroll.mark_keyboard_triggered_current_scroll();navigate.page_up();return true;case "page_down":case "vim_page_down":case "spacebar":+ message_scroll.mark_keyboard_triggered_current_scroll();navigate.page_down();return true;case "copy_with_c":diff --git a/static/js/message_scroll.js b/static/js/message_scroll.jsindex 656040b1c67..77fe797bfd9 100644--- a/static/js/message_scroll.js+++ b/static/js/message_scroll.js@@ -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);}