diff options
author | Devaev Maxim <[email protected]> | 2020-08-20 04:07:00 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2020-08-20 04:07:00 +0300 |
commit | ebc7b3a808743f087b5116810af653fa84738075 (patch) | |
tree | 4f8876b5d5594dbfb5965b9ce0e416ca719b2a15 | |
parent | eb8a34a82da14fff7971f7cbe78be339822019d0 (diff) |
Fixed pikvm/pikvm#45
-rw-r--r-- | web/share/js/wm.js | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/web/share/js/wm.js b/web/share/js/wm.js index 23d64af3..f4a0dbee 100644 --- a/web/share/js/wm.js +++ b/web/share/js/wm.js @@ -62,7 +62,7 @@ function __WindowManager() { let el_button = el_window.querySelector(".window-header .window-button-close"); if (el_button) { tools.setOnClick(el_button, function() { - el_window.style.visibility = "hidden"; + __closeWindow(el_window); __activateLastWindow(el_window); }); } @@ -111,7 +111,7 @@ function __WindowManager() { el_window.appendChild(el_buttons); function close(retval) { - el_window.style.visibility = "hidden"; + __closeWindow(el_window); el_modal.outerHTML = ""; let index = __windows.indexOf(el_modal); if (index !== -1) { @@ -208,6 +208,12 @@ function __WindowManager() { }; }; + var __closeWindow = function(el_window) { + el_window.focus(); + el_window.blur(); + el_window.style.visibility = "hidden"; + }; + var __toggleMenu = function(el_a) { let all_hidden = true; @@ -354,8 +360,7 @@ function __WindowManager() { tools.debug("UI: Activating last window:", el_last_window); __activateWindow(el_last_window); } else { - tools.debug("UI: Unsetting focuse because no windows left"); - document.activeElement.blur(); + tools.debug("UI: No last window to activation"); } }; |