From 476557aba8b55869d91857dbcfe2f3a073879897 Mon Sep 17 00:00:00 2001 From: Salvialf Date: Fri, 8 Dec 2023 20:45:56 +0100 Subject: [PATCH] better handle of close modal on escape --- core/dom/dom.ui.js | 3 ++- desktop/common/js/utils.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/core/dom/dom.ui.js b/core/dom/dom.ui.js index 6f4ecde54a..139c90dca8 100644 --- a/core/dom/dom.ui.js +++ b/core/dom/dom.ui.js @@ -1580,7 +1580,8 @@ var jeeDialog = (function() { this.dialog.unseen() this.dialog._jeeDialog.options.onClose() this.dialog.removeClass('active') - document.querySelectorAll('div.jeeDialog.jeeDialogMain:not([style*="display: none;"])')[0]?.addClass('active') + let _dialog = document.querySelectorAll('div.jeeDialog.jeeDialogMain:not([style*="display: none;"])') + _dialog[_dialog.length - 1]?.addClass('active') cleanBackdrop() }, destroy: function() { diff --git a/desktop/common/js/utils.js b/desktop/common/js/utils.js index 62cc700688..a04c55868b 100644 --- a/desktop/common/js/utils.js +++ b/desktop/common/js/utils.js @@ -879,9 +879,10 @@ jeedomUtils.setJeedomGlobalUI = function() { event.target.value = '' return } - else + else if (event.target.matches('body')) { //close active modal document.querySelector('div.jeeDialog.active')?._jeeDialog.close() + } } })