From d2a9b5dda52bc803907f422d377346e70ba5bf98 Mon Sep 17 00:00:00 2001 From: Maneesh Shukla Date: Thu, 6 Mar 2025 19:56:39 +0530 Subject: [PATCH] modals: Remove `data-dismiss` usage and update cancel actions. Replaced `data-dismiss="modal"` attributes with class/ID-based event handling to align with Micromodal usage. Also removed an unused CSS rule which was defined. --- web/src/stream_settings_ui.ts | 22 +++++++++++-------- web/src/user_group_edit.ts | 22 +++++++++++-------- web/styles/settings.css | 6 ----- .../stream_settings/stream_creation_form.hbs | 2 +- .../user_group_creation_form.hbs | 2 +- 5 files changed, 28 insertions(+), 26 deletions(-) diff --git a/web/src/stream_settings_ui.ts b/web/src/stream_settings_ui.ts index 6fd0a068b5..3ca7f27bf6 100644 --- a/web/src/stream_settings_ui.ts +++ b/web/src/stream_settings_ui.ts @@ -1051,15 +1051,19 @@ export function initialize(): void { open_create_stream(); }); - $("#channels_overlay_container").on("click", "#stream_creation_form [data-dismiss]", (e) => { - e.preventDefault(); - // we want to make sure that the click is not just a simulated - // click; this fixes an issue where hitting "Enter" would - // trigger this code path due to bootstrap magic. - if (e.clientY !== 0) { - stream_edit.open_edit_panel_empty(); - } - }); + $("#channels_overlay_container").on( + "click", + "#stream_creation_form .create_stream_cancel", + (e) => { + e.preventDefault(); + // we want to make sure that the click is not just a simulated + // click; this fixes an issue where hitting "Enter" would + // trigger this code path due to bootstrap magic. + if (e.clientY !== 0) { + stream_edit.open_edit_panel_empty(); + } + }, + ); $("#channels_overlay_container").on("click", ".email-address", function (this: HTMLElement) { selectText(this); diff --git a/web/src/user_group_edit.ts b/web/src/user_group_edit.ts index cd6aa4df05..6da9ce3206 100644 --- a/web/src/user_group_edit.ts +++ b/web/src/user_group_edit.ts @@ -1947,15 +1947,19 @@ export function initialize(): void { open_create_user_group(); }); - $("#groups_overlay_container").on("click", "#user_group_creation_form [data-dismiss]", (e) => { - e.preventDefault(); - // we want to make sure that the click is not just a simulated - // click; this fixes an issue where hitting "Enter" would - // trigger this code path due to bootstrap magic. - if (e.clientY !== 0) { - open_right_panel_empty(); - } - }); + $("#groups_overlay_container").on( + "click", + "#user_group_creation_form .create_user_group_cancel", + (e) => { + e.preventDefault(); + // we want to make sure that the click is not just a simulated + // click; this fixes an issue where hitting "Enter" would + // trigger this code path due to bootstrap magic. + if (e.clientY !== 0) { + open_right_panel_empty(); + } + }, + ); $("#groups_overlay_container").on("click", ".group-row", show_right_section); diff --git a/web/styles/settings.css b/web/styles/settings.css index cf5a1d960d..4d02c65228 100644 --- a/web/styles/settings.css +++ b/web/styles/settings.css @@ -268,12 +268,6 @@ h3, display: inline !important; } - /* Messy implementation of buttons with text and a pencil icon in them - having spacing before the pencil icon. */ - button[data-dismiss="modal"] i.fa-pencil { - margin-left: 3px; - } - .hidden-email { font-style: italic; } diff --git a/web/templates/stream_settings/stream_creation_form.hbs b/web/templates/stream_settings/stream_creation_form.hbs index ef58b42a44..3cf3b4d055 100644 --- a/web/templates/stream_settings/stream_creation_form.hbs +++ b/web/templates/stream_settings/stream_creation_form.hbs @@ -50,7 +50,7 @@ diff --git a/web/templates/user_group_settings/user_group_creation_form.hbs b/web/templates/user_group_settings/user_group_creation_form.hbs index ba6caa68ac..9f748afd35 100644 --- a/web/templates/user_group_settings/user_group_creation_form.hbs +++ b/web/templates/user_group_settings/user_group_creation_form.hbs @@ -49,7 +49,7 @@