From 5f8b8a214797189696fcb8434be1196914eae6db Mon Sep 17 00:00:00 2001 From: Nariman Jelveh Date: Mon, 17 Jun 2024 13:17:37 -0700 Subject: [PATCH] Make sure an iframe is focused after app is loaded --- src/IPC.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/IPC.js b/src/IPC.js index c3809d86..8e9499df 100644 --- a/src/IPC.js +++ b/src/IPC.js @@ -100,6 +100,13 @@ window.addEventListener('message', async (event) => { // Send any saved broadcasts to the new app globalThis.services.get('broadcast').sendSavedBroadcastsTo(event.data.appInstanceID); + + // If `window-active` is set (meanign the window is focused), focus the window one more time + // this is to ensure that the iframe is `definitely` focused and can receive keyboard events (e.g. keydown) + if($el_parent_window.hasClass('window-active')){ + $el_parent_window.focusWindow(); + } + } //------------------------------------------------- // windowFocused