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.

message_viewport: Fix msg selection not updated on scroll.

Aman Agrawalbb8d0684e7bb
diff --git a/web/src/message_viewport.ts b/web/src/message_viewport.ts
index 6887ce7eb88..1e07e99fb6c 100644
--- a/web/src/message_viewport.ts
+++ b/web/src/message_viewport.ts
@@ -153,6 +153,16 @@ export function set_message_position(
const new_scroll_top = message_top - message_offset;
+ // Ensure we will scroll before we disable updating selection.
+ // This avoids a bug where message selection doesn't change on user scroll.
+ if (
+ // Can't scroll up if we are already at top.
+ (new_scroll_top <= 0 && window.scrollY === 0) ||
+ // Can't scroll down if we are already at bottom.
+ (new_scroll_top >= height() && window.scrollY === height())
+ ) {
+ return;
+ }
message_scroll_state.set_update_selection_on_next_scroll(false);
scrollTop(new_scroll_top);
}