From d0f8515b50033e03122b8ff7c8b4bae3ee09d0e8 Mon Sep 17 00:00:00 2001 From: Ganesh Pawar Date: Sat, 13 Feb 2021 22:42:43 +0530 Subject: [PATCH] settings_ui: Use `overlays.open_modal` in user deactivation settings. Hiding and instantly showing a modal causes a race condition in Bootstrap since `hide` and `show` calls are asynchronous. See https://getbootstrap.com/docs/4.0/components/modal/#methods Instead, use `overlays.open_modal` which prevents background mouse events when a modal is present. This prevents a user from maybe accidentally clicking on another deactivate button while a modal is present. This also prevents a black screen caused due to this race condition. And since a user can't click on the button while the modal is present, it doesn't make sense to hide it before showing it. So, remove the `hide` call. Fixes #17297 --- static/js/settings_users.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/static/js/settings_users.js b/static/js/settings_users.js index fab1022af2..21c258ea52 100644 --- a/static/js/settings_users.js +++ b/static/js/settings_users.js @@ -538,11 +538,10 @@ function confirm_deactivation(row, user_id, status_field) { settings_ui.do_settings_change(channel.del, url, {}, status_field, opts); } - modal_elem.modal("hide"); modal_elem.off("click", ".do_deactivate_button"); set_fields(); modal_elem.on("click", ".do_deactivate_button", handle_confirm); - modal_elem.modal("show"); + overlays.open_modal("#deactivation_user_modal"); } function handle_deactivation(tbody, status_field) {