[Bug]: BrowserWindow#show() does not consistently activate and show window
jz-notion opened this issue · 0 comments
jz-notion commented
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
Reproducible since 30.0.0
What operating system are you using?
macOS
Operating System Version
Sonoma 14.4.1
What arch are you using?
arm64 (including Apple Silicon)
Last Known Working Electron version
29.3.3
Expected Behavior
Calling show()
on a BrowserWindow
instance should foreground and focus the window.
Actual Behavior
show()
appears to be inconsistent in whether or not it foregrounds the window. Sometimes it works, sometimes it doesn't.showInactive()
appears to be consistent in foregrounding the window. (It just doesn't focus the window, which is expected.)
Testcase Gist URL
https://gist.github.com/jz-notion/20accc61a10f011eef7b2255a5b90c36
Additional Information
I noticed the implementation difference below for macOS 14.0 onwards. According to Apple docs, activate
does not guarantee app activation.
Use this method to request app activation; calling this method doesn’t guarantee app activation.
electron/shell/browser/native_window_mac.mm
Lines 473 to 476 in 4c27b0c
This topic was discussed during the change to using activate
instead of activateIgnoringOtherApps
: #40307 (comment)