fix(app): prevent focus issue by checking frame existence before handling dom-ready

This commit is contained in:
purocean
2025-01-10 15:53:33 +08:00
parent 5786e716aa
commit b33046cb1b
+4
View File
@@ -610,6 +610,10 @@ if (!gotTheLock) {
// fix focus issue after dialog show on Windows.
webContents.on('frame-created', (_, { frame }) => {
if (!frame) {
return
}
frame.on('dom-ready', () => {
frame.executeJavaScript(`if ('ctx' in window && ctx?.env?.isWindows) {
window._FIX_ELECTRON_DIALOG_FOCUS ??= function () {