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.

hashchange: Disable scroll position restoration.

Aman Agrawal95f8b3a6180f
diff --git a/web/src/hashchange.js b/web/src/hashchange.js
index 2a81dbaefd2..88c1a344c4d 100644
--- a/web/src/hashchange.js
+++ b/web/src/hashchange.js
@@ -420,6 +420,10 @@ function hashchanged(from_reload, e) {
}
export function initialize() {
+ // We don't want browser to restore the scroll
+ // position of the new hash in the current hash.
+ window.history.scrollRestoration = "manual";
+
$(window).on("hashchange", (e) => {
hashchanged(false, e.originalEvent);
});