electron: [Bug]: Calling webContents.focus() forces the entire window to raise above other windows on Linux/GNOME
Preflight Checklist
- I have read the Contributing Guidelines for this project.
- I agree to follow the Code of Conduct that this project adheres to.
- I have searched the issue tracker for a bug report that matches the one I want to file, without success.
Electron Version
24.1.3
What operating system are you using?
Ubuntu
Operating System Version
22.04.2 LTS, GNOME 42.5
What arch are you using?
x64
Last Known Working Electron version
Not sure, it’s been around a while.
Expected Behavior
- Using
gnome-tweaks, turn on “Focus on Hover” under the Windows category - Open an Electron app where
webContents.focus()is called when the window is focused (see gist), and then click on another window that overlaps the application. - Move the cursor over the Electron app’s window.
The app should take focus, but the window should not raise above the overlapping app.
Actual Behavior
The app takes focus, and the window raises over top.
Testcase Gist URL
https://gist.github.com/devinbinnie/c0262f5c890edc033fdfe5b7e4209ded
Additional Information
This issue particularly impacts applications where the developer might want to focus a BrowserView when the application is focused, and the user has “sloppy focus” or focus-on-hover enabled on their system.
eg. This issue: https://github.com/mattermost/desktop/issues/1827
About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 5
- Comments: 20
+1