[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:
@@ -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();
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user