inbox: Fix inbox scrolled to top when returning from other narrows.

This has to do with narrows and inbox view sharing the same
scrolling container.
This commit is contained in:
Aman Agrawal 2023-09-20 05:35:46 +00:00 committed by Tim Abbott
parent 6411dbe124
commit 0e5c6ec5b9
2 changed files with 13 additions and 5 deletions

View File

@ -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");

View File

@ -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);