[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
This commit is contained in:
Devin Binnie
2025-05-22 15:27:38 -04:00
committed by GitHub
parent 2879ada39a
commit 742862e9a2

View File

@@ -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 // 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 // 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'); log.debug('URL view focus prevented');
this.getCurrentView()?.focus(); this.getCurrentView()?.focus();
}); });