modal: Fix button height issue on modals with long text on submit button.

This commit fixes an issue where the button height increases while
it has the spinner on modals with long text on the submit button. The
issue occurred due to the button height being calculated after hiding
the span element, which resulted in an incorrect height. To overcome
this, the commit suggests computing the span element's height before
hiding it to ensure that the button height is accurately set.
This commit is contained in:
Akarsh Jain
2023-03-05 21:49:06 +05:30
committed by Tim Abbott
parent 73fd729c4b
commit 132c4245d0

View File

@@ -79,13 +79,17 @@ export function hide_dialog_spinner(): void {
} }
export function show_dialog_spinner(): void { export function show_dialog_spinner(): void {
$(".dialog_submit_button span").hide();
// Disable both the buttons. // Disable both the buttons.
$("#dialog_widget_modal .modal__btn").prop("disabled", true); $("#dialog_widget_modal .modal__btn").prop("disabled", true);
const $spinner = $("#dialog_widget_modal .modal__spinner"); const $spinner = $("#dialog_widget_modal .modal__spinner");
const dialog_submit_button_span_width = $(".dialog_submit_button span").width(); const dialog_submit_button_span_width = $(".dialog_submit_button span").width();
const dialog_submit_button_span_height = $(".dialog_submit_button span").height(); const dialog_submit_button_span_height = $(".dialog_submit_button span").height();
// Hide the submit button after computing its height, since submit
// buttons with long text might affect the size of the button.
$(".dialog_submit_button span").hide();
loading.make_indicator($spinner, { loading.make_indicator($spinner, {
width: dialog_submit_button_span_width, width: dialog_submit_button_span_width,
height: dialog_submit_button_span_height, height: dialog_submit_button_span_height,