diff options
| author | RblSb <msrblsb@gmail.com> | 2025-05-02 17:17:00 +0300 |
|---|---|---|
| committer | RblSb <msrblsb@gmail.com> | 2025-05-02 17:17:00 +0300 |
| commit | 4b48de4f824ce48f1466014a9e9aa24023212181 (patch) | |
| tree | e1b52ce890f059bff3ca33e5ddcee07d1f51ec63 | |
| parent | 047a2b3d175cd836d2abc2c5e80371b13bb0a6cc (diff) | |
Ignore window.onblur for iframe clicks
closes #63
| -rw-r--r-- | res/client.js | 8 | ||||
| -rw-r--r-- | src/client/Main.hx | 5 |
2 files changed, 10 insertions, 3 deletions
diff --git a/res/client.js b/res/client.js index 5c52461..ba579ba 100644 --- a/res/client.js +++ b/res/client.js @@ -1399,7 +1399,11 @@ var client_Main = function() { return _gthis.isPageUnloading = true; }); window.addEventListener("blur",function() { - return _gthis.isPageVisible = false; + var tmp = window.document.activeElement; + if((tmp != null ? tmp.tagName : null) == "IFRAME") { + return; + } + _gthis.isPageVisible = false; }); window.addEventListener("focus",function() { return _gthis.isPageVisible = true; @@ -1744,7 +1748,7 @@ client_Main.prototype = { var data = JSON.parse(e.data); if(this.config != null && this.config.isVerbose) { var t = data.type; - haxe_Log.trace("Event: " + data.type,{ fileName : "src/client/Main.hx", lineNumber : 486, className : "client.Main", methodName : "onMessage", customParams : [Reflect.field(data,t.charAt(0).toLowerCase() + HxOverrides.substr(t,1,null))]}); + haxe_Log.trace("Event: " + data.type,{ fileName : "src/client/Main.hx", lineNumber : 489, className : "client.Main", methodName : "onMessage", customParams : [Reflect.field(data,t.charAt(0).toLowerCase() + HxOverrides.substr(t,1,null))]}); } client_JsApi.fireEvents(data); switch(data.type) { diff --git a/src/client/Main.hx b/src/client/Main.hx index 9a4c809..d3d1ce2 100644 --- a/src/client/Main.hx +++ b/src/client/Main.hx @@ -117,7 +117,10 @@ class Main { document.addEventListener("click", onFirstInteraction); window.addEventListener("beforeunload", () -> isPageUnloading = true); - window.addEventListener("blur", () -> isPageVisible = false); + window.addEventListener("blur", () -> { + if (document.activeElement?.tagName == "IFRAME") return; + isPageVisible = false; + }); window.addEventListener("focus", () -> isPageVisible = true); document.addEventListener("visibilitychange", () -> { isPageVisible = document.visibilityState == VISIBLE; |
