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(); });