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
fix: Windows Toast notification dismissal from Action Center #40197
Conversation
ae8c5a3
to
f013c0d
Compare
c18de9b
to
6a637fa
Compare
Merging as CI failure is unrelated to PR changed and is fixed via #40241. |
Release Notes Persisted
|
I have automatically backported this PR to "26-x-y", please check out #40242 |
I have automatically backported this PR to "28-x-y", please check out #40243 |
I have automatically backported this PR to "27-x-y", please check out #40244 |
…n#40197) * fix: Windows Toast notification dismissal from Action Center * docs: note Toast behavior in event * chore: address feedback from review
…n#40197) * fix: Windows Toast notification dismissal from Action Center * docs: note Toast behavior in event * chore: address feedback from review
Description of Change
Closes #40133
Inspiration taken from upstream
This PR closes a longstanding issue whereby Windows Toast notifications could only be dismissed and prevented from living in the Action Center until removed by the user if
.close
is called on them while the Notification is visible to the user. On an API level, WhenToastNotifier.Hide
is called, theToastNotification
is removed from the screen if it is currently visible, and it is not sent to the Action Center. AToastNotification
is considered dismissed per underlying callbacks if it leaves the screen, and so our existing logic destroyed and garbage collected the underlying notification as soon as the notification left the screen regardless of whether it was dismissed programmatically, by the user, or by timeout.If it was dismissed by the user or by timeout, it entered the Action Center, and
notification.close()
then appeared to have no effect because the notification in JS-land was still alive. In order to address this problem, and ensure that the notification's behavior aligned more closely with 1) our documentation and 2) other platforms, we need to make some changes to garbage collection behavior as well as which APIs are called depending on whether theToastNotification
has already entered the Action Center. If it is dismissed by timeout or sent to the Action Center by the user, we want to notify the user via event, but now, we do not want to immediately destroy the underlying notification. We instead want to wait until the notification is destroyed programmatically or removed from the action center to destroy the underlyingToastNotification
. We use theToastNotificationHistory
class to remove it from the Action Center.Checklist
npm test
passesRelease Notes
Notes: Fixed an issue where Windows Toast notifications weren't properly dismissed from the Action Center on
notification.close()
if they'd previously been dismissed.