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.

inbox: Attempt to fix inbox scrolling to top unexpectedly.

Aman Agrawal626524ba8e3f
diff --git a/web/src/inbox_ui.ts b/web/src/inbox_ui.ts
index 8551971d7ae..2d2bafb6971 100644
--- a/web/src/inbox_ui.ts
+++ b/web/src/inbox_ui.ts
@@ -2123,8 +2123,14 @@ export function initialize({hide_other_views}: {hide_other_views: () => void}):
$(document).on(
"scroll",
_.throttle(() => {
- move_focus_to_visible_area();
- }, 50),
+ if (!inbox_util.is_visible()) {
+ // This check is duplicated with move_focus_to_visible_area. It
+ // is worth doing to avoid the performance hit of wrapping
+ // requestAnimationFramearound a likely noop.
+ return;
+ }
+ requestAnimationFrame(move_focus_to_visible_area);
+ }, 100),
);
$("body").on(