Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

alert() and confirm() breaks focus, refocusing BrowserWindow can fix this issue #280

Open
fabiofabbri84 opened this issue Oct 1, 2024 · 0 comments

Comments

@fabiofabbri84
Copy link

Electron has a known bug: if you call alert() or confirm(), focus breaks, so for example you can't enter text in an input field after these functions are called. See electron/electron#31917 and electron/electron#41603

Losing and regaining the focus fixes this quirk, so we made a plugin that overrides alert() and confirm() in order to call BrowserWindow.getFocusedWindow().blur() and focus() on the main process after the native dialogs functions returns.

(I'm not sure if BrowserWindow.getFocusedWindow() is the best way to get the window, but it works and I think this is a good way to handle it if there are multiple windows)

So if this issue affects your Cordova Electron app, you can use our plugin: https:/cimatti/cordova-electron-dialogs-fix

However I think this fix could be included in future versions of cordova-electron

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant