From 742862e9a298661713a04b3409fcd59c526cd327 Mon Sep 17 00:00:00 2001 From: Devin Binnie <52460000+devinbinnie@users.noreply.github.com> Date: Thu, 22 May 2025 15:27:38 -0400 Subject: [PATCH] [MM-62005] Use `ready-to-show` event for focus workaround for URL view (#3429) * [MM-62005] Use `ready-to-show` event for focus workaround for URL view * Fix checks --- src/main/views/viewManager.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/views/viewManager.ts b/src/main/views/viewManager.ts index 04b38f7e..59564eff 100644 --- a/src/main/views/viewManager.ts +++ b/src/main/views/viewManager.ts @@ -382,7 +382,8 @@ export class ViewManager { // This is a workaround for an issue where the URL view would steal focus from the main window // See: https://github.com/electron/electron/issues/42339 - urlView.webContents.on('focus', () => { + // @ts-expect-error Using an undocumented event that fires last when the URL view pops up + urlView.webContents.once('ready-to-show', () => { log.debug('URL view focus prevented'); this.getCurrentView()?.focus(); });