Repository navigation
fix: trigger activate event when app is activated via app switcher - #23727
Conversation
|
💖 Thanks for opening this pull request! 💖 We use semantic commit messages to streamline the release process. Before your pull request can be merged, you should update your pull request title to start with a semantic prefix. Examples of commit messages with semantic prefixes:
Things that will help get your PR across the finish line:
We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can. |
|
Tests are failing but the same one are failing on develop as well. I guess it's being taken care of in #23699. Also I didn't provided any tests for this, but if anyone will give me some hints how to test this functionality I'll be happy to do so 😄 |
zcbenz
left a comment
There was a problem hiding this comment.
Can you leave a comment in the code on why applicationDidBecomeActive is used for implementing Activate? In case someone else refactored the code in future.
A link to this PR should be enough.
When application is activated thru macOS app switcher (cmd+tab) the App's activate event is note emitted. The reason is that `applicationShouldHandleReopen:hasVisibleWindows:` is sent only when app is activated via Dock. Using `applicationDidBecomeActive:` is handling all cases properly.
|
@zcbenz yeah, of course! Updated the comment in the code. Thanks for taking look at it 🙇 |
|
Congrats on merging your first pull request! 🎉🎉🎉 |
|
No Release Notes |
|
I have automatically backported this PR to "10-x-y", please check out #23771 |
|
I have automatically backported this PR to "8-x-y", please check out #23772 |
|
I have automatically backported this PR to "9-x-y", please check out #23773 |
|
/trop run backport |
|
The backport process for this PR has been manually initiated, here we go! :D |
|
I was unable to backport this PR to "7-3-x" cleanly; |
|
@isnotgood has manually backported this PR to "7-3-x", please check out #23775 |
|
@isnotgood I do not fully understand this change. Does this mean |
|
@bpasero ouch, unfortunately you understand correctly😢 In that case we need to revert this one back to use |
|
Yes, adding a separate event seems better. |
|
Yeah this should be reverted and adding a new event looks good to me. I'll revert the PRs, thanks for bringing this up. |
When application is activated thru macOS app switcher (cmd+tab) the App's activate event is note emitted. Here is Electron Fiddle with steps to repro (tested on macOS 10.15.4).
Description of Change
The reason is that
applicationShouldHandleReopen:hasVisibleWindows:is sent only when appis activated via Dock not the other ways like app switcher. Using
applicationDidBecomeActive:is handling all the cases properly. Also to maintain backward compatibility I added logic to avoid firing 'activate' event after the application launch.Checklist
npm testpassesRelease Notes
Notes: none