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: Fix inbox scrolled to top when returning from other narrows.

Aman Agrawal0e5c6ec5b98c
diff --git a/web/src/inbox_ui.js b/web/src/inbox_ui.js
index 43601969c24..ecbc3c4d3f5 100644
--- a/web/src/inbox_ui.js
+++ b/web/src/inbox_ui.js
@@ -462,7 +462,10 @@ export function complete_rerender() {
);
update_filters();
show_empty_inbox_text(has_visible_unreads);
-
+ // If the focus is not on the inbox rows, the inbox view scrolls
+ // downwhen moving from other views to the inbox view. To avoid
+ // this, we scroll to top before restoring focus.
+ $("html").scrollTop(0);
setTimeout(() => {
// We don't want to focus on simplebar ever.
$("#inbox-list .simplebar-content-wrapper").attr("tabindex", "-1");
diff --git a/web/src/message_edit.js b/web/src/message_edit.js
index 9e280248eee..d7c73a1940c 100644
--- a/web/src/message_edit.js
+++ b/web/src/message_edit.js
@@ -719,12 +719,17 @@ export function toggle_resolve_topic(
url: "/json/messages/" + message_id,
data: request,
success() {
- const $spinner = $row.find(".toggle_resolve_topic_spinner");
- loading.destroy_indicator($spinner);
+ if ($row) {
+ const $spinner = $row.find(".toggle_resolve_topic_spinner");
+ loading.destroy_indicator($spinner);
+ }
},
error(xhr) {
- const $spinner = $row.find(".toggle_resolve_topic_spinner");
- loading.destroy_indicator($spinner);
+ if ($row) {
+ const $spinner = $row.find(".toggle_resolve_topic_spinner");
+ loading.destroy_indicator($spinner);
+ }
+
if (xhr.responseJSON) {
if (xhr.responseJSON.code === "MOVE_MESSAGES_TIME_LIMIT_EXCEEDED") {
handle_resolve_topic_failure_due_to_time_limit(topic_is_resolved);