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

[Bug]: BrowserWindow#show() does not consistently activate and show window #42157

Closed
3 tasks done
jz-notion opened this issue May 13, 2024 · 0 comments · Fixed by #42180
Closed
3 tasks done

[Bug]: BrowserWindow#show() does not consistently activate and show window #42157

jz-notion opened this issue May 13, 2024 · 0 comments · Fixed by #42180
Labels
bug 🪲 has-repro-gist Issue can be reproduced with code at https://gist.github.com/

Comments

@jz-notion
Copy link

jz-notion commented May 13, 2024

Preflight Checklist

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.

if (@available(macOS 14.0, *)) {
[[NSApplication sharedApplication] activate];
} else {
[[NSApplication sharedApplication] activateIgnoringOtherApps:YES];

This topic was discussed during the change to using activate instead of activateIgnoringOtherApps: #40307 (comment)

@electron-issue-triage electron-issue-triage bot added the has-repro-gist Issue can be reproduced with code at https://gist.github.com/ label May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🪲 has-repro-gist Issue can be reproduced with code at https://gist.github.com/
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant