mirror of https://github.com/zulip/zulip.git
popovers: Fix bug where modals persisted on hashchange.
Modals like those for Read receipts, Schedule message, Message edit history, User profile, etc would not close when the hash changed. Now we close any active modal whenever the hash changes; we add a new function in `modals.ts` to do this, and call it from `hashchange.js`.
This commit is contained in:
parent
3f2ab44f94
commit
82f105aada
|
@ -14,6 +14,7 @@ import * as info_overlay from "./info_overlay";
|
|||
import * as message_lists from "./message_lists";
|
||||
import * as message_scroll from "./message_scroll";
|
||||
import * as message_viewport from "./message_viewport";
|
||||
import * as modals from "./modals";
|
||||
import * as narrow from "./narrow";
|
||||
import * as overlays from "./overlays";
|
||||
import {page_params} from "./page_params";
|
||||
|
@ -407,6 +408,7 @@ function hashchanged(from_reload, e) {
|
|||
overlays.close_for_hash_change();
|
||||
sidebar_ui.hide_all();
|
||||
popovers.hide_all();
|
||||
modals.close_active_if_any();
|
||||
browser_history.state.changing_hash = true;
|
||||
const ret = do_hashchange_normal(from_reload);
|
||||
browser_history.state.changing_hash = false;
|
||||
|
|
|
@ -237,3 +237,9 @@ export function close_active(): void {
|
|||
const $micromodal = $(".micromodal.modal--open");
|
||||
Micromodal.close(`${CSS.escape($micromodal.attr("id") ?? "")}`);
|
||||
}
|
||||
|
||||
export function close_active_if_any(): void {
|
||||
if (any_active()) {
|
||||
close_active();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue