Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
stream: Use 'hidden.bs.modal' event for enabling mouse background events.
sahil839f73d101854c3
diff --git a/static/js/click_handlers.js b/static/js/click_handlers.jsindex 042d3fdc078..1b3b487d2e5 100644--- a/static/js/click_handlers.js+++ b/static/js/click_handlers.js@@ -947,6 +947,11 @@ export function initialize() {e.stopPropagation();});+ $("body").on("hidden.bs.modal", () => {+ // Enable mouse events for the background as the modal closes.+ overlays.enable_background_mouse_events();+ });+// MAIN CLICK HANDLER$(document).on("click", (e) => {@@ -966,12 +971,6 @@ export function initialize() {popovers.hide_all();}- // If user clicks outside an active modal- if ($(".modal.in").has(e.target).length === 0) {- // Enable mouse events for the background as the modal closes- $(".overlay.show").attr("style", null);- }-if (compose_state.composing()) {if ($(e.target).closest("a").length > 0) {// Refocus compose message text box if link is clickeddiff --git a/static/js/overlays.js b/static/js/overlays.jsindex 28ae643eaad..dbb715a5733 100644--- a/static/js/overlays.js+++ b/static/js/overlays.js@@ -199,8 +199,6 @@ export function close_modal(selector) {const elem = $(selector).expectOne();elem.modal("hide").attr("aria-hidden", true);- // Enable mouse events for the background as the modal closes.- enable_background_mouse_events();}export function close_active_modal() {diff --git a/static/js/settings_account.js b/static/js/settings_account.jsindex 5b99d6a090e..95b432dee92 100644--- a/static/js/settings_account.js+++ b/static/js/settings_account.js@@ -403,14 +403,6 @@ export function set_up() {clear_password_change();});- // If the modal is closed using the 'close' button or the 'Cancel' button- $(".modal")- .find("[data-dismiss=modal]")- .on("click", () => {- // Enable mouse events for the background on closing modal- $(".overlay.show").attr("style", null);- });-$("#change_password_button").on("click", (e) => {e.preventDefault();e.stopPropagation();diff --git a/static/js/stream_edit.js b/static/js/stream_edit.jsindex d2b825be842..222f2c69b74 100644--- a/static/js/stream_edit.js+++ b/static/js/stream_edit.js@@ -746,17 +746,6 @@ export function initialize() {$("#subscriptions_table").on("click", "#change-stream-privacy-button", change_stream_privacy);$("#subscriptions_table").on("click", ".close-modal-btn", (e) => {- // Re-enable background mouse events when we close the modal- // via the "x" in the corner. (The other modal-close code- // paths call `overlays.close_modal`, rather than using- // bootstrap's data-dismiss=modal feature, and this is done- // there).- //- // TODO: It would probably be better to just do this- // unconditionally inside the handler for the event sent by- // bootstrap on closing a modal.- overlays.enable_background_mouse_events();-// This fixes a weird bug in which, subscription_settings hides// unexpectedly by clicking the cancel button in a modal on top of it.e.stopPropagation();