diff options
author | Devaev Maxim <[email protected]> | 2020-09-23 18:45:19 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2020-09-23 18:45:35 +0300 |
commit | bbf3b18fe3350c08e6dbcfde20a9e2a4685e8be1 (patch) | |
tree | b35e913be393a2a7ba3e8a390295192814a78912 /web | |
parent | 2178d22fec8450275c8b21d00d7c88202ffde2db (diff) |
proper handling of dont-hide-menu
Diffstat (limited to 'web')
-rw-r--r-- | web/share/js/wm.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/web/share/js/wm.js b/web/share/js/wm.js index f4a0dbee..fb4b30a1 100644 --- a/web/share/js/wm.js +++ b/web/share/js/wm.js @@ -84,6 +84,8 @@ function __WindowManager() { self.confirm = (...args) => __modalDialog("Question", args.join(" "), true, true); var __modalDialog = function(header, text, ok, cancel) { + let el_active_menu = (document.activeElement && document.activeElement.closest(".menu")); + let el_modal = document.createElement("div"); el_modal.className = "modal"; el_modal.style.visibility = "visible"; @@ -117,7 +119,11 @@ function __WindowManager() { if (index !== -1) { __windows.splice(index, 1); } - __activateLastWindow(el_modal); + if (el_active_menu && el_active_menu.style.visibility === "visible") { + el_active_menu.focus(); + } else { + __activateLastWindow(el_modal); + } resolve(retval); } @@ -288,7 +294,7 @@ function __WindowManager() { }; var __globalMouseButtonHandler = function(event) { - if (!event.target.matches(".menu-button")) { + if (!event.target.matches(".menu-button") && !event.target.closest(".modal")) { for (let el_item = event.target; el_item && el_item !== document; el_item = el_item.parentNode) { if (el_item.hasAttribute("data-force-hide-menu")) { break; |