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.

popovers: Fix bug where modals persisted on hashchange.

N-Shar-ma82f105aadae0
diff --git a/web/src/hashchange.js b/web/src/hashchange.js
index bd62bf4e333..8f9c3120164 100644
--- a/web/src/hashchange.js
+++ b/web/src/hashchange.js
@@ -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;
diff --git a/web/src/modals.ts b/web/src/modals.ts
index 3876173505b..fb0033b75f3 100644
--- a/web/src/modals.ts
+++ b/web/src/modals.ts
@@ -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();
+ }
+}