From 4ccaff6e32d31babda347dc40dbdd197d8fa9143 Mon Sep 17 00:00:00 2001 From: Ganesh Pawar Date: Wed, 24 Nov 2021 20:22:32 +0530 Subject: [PATCH] modal: Hide, instead of empty, the dialog error element. Consider a modal with an error element displayed. When a user clicks the submit button, the current behaviour is to empty the element. This empties the inner HTML of the error element, but the CSS makes it still visible, just empty. This looks bad. To avoid this, we hide the element. We use the `ui_report` module to display errors, which adds the `show` class to the error element every time an error is to be displayed. This makes sure that the error element isn't hidden when the user re-clicks the submit button while the modal is still open. --- static/js/dialog_widget.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/js/dialog_widget.js b/static/js/dialog_widget.js index c16b0517cd..6b5968457a 100644 --- a/static/js/dialog_widget.js +++ b/static/js/dialog_widget.js @@ -134,7 +134,7 @@ export function launch(conf) { } else if (conf.close_on_submit) { close_modal(); } - $("#dialog_error").empty(); + $("#dialog_error").hide(); conf.on_click(e); });