Chrome macOS 15 extra notification workaround #1209
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
One Line Summary
Work around for extra "This site has been updated in the background" notification being shown on Chrome on macOS 15.
Details
macOS 15 made some unknown changes that causes Chrome's fragile notification display detection to fail, which means an extra notification with the body "This site has been updated in the background" displays.
This was reported to Google under this issue:
https://issues.chromium.org/issues/378103918
A workaround was found that if you delay ending the service worker event for a bit then Chrome will detect the notification from macOS. However this work around won't work 100% of the time since if a notification is closed very quickly (within the 1000ms). This window is also much easier to hit if notifications are sent back-to-back. Lastly it is unknown if 1000ms is always enough time, but too much time isn't good either due what was noted earlier.
We scoped this workaround to the known target of Chromium on macOS 15 so this ~1% chance doesn't cause issues on other platforms. We can't detect the macOS version so this will effect all versions.
What this does not fix:
There is also an issue where if the OneSignal feature received receipts / confirmed deliveries is on and the notification is clicked or closed with in it's wait window this extra notification will display. We will address this in a different PR.
Validation
Tests
Tested on macOS 15.1 with Chrome and Firefox.
Info
Checklist
Programming Checklist
Interfaces:
Functions:
Typescript:
Other:
elem of array
syntax. PreferforEach
or usemap
context
if possible. Instead, we can pass it to function/constructor so that we don't callOneSignal.context
Screenshots
Info
Checklist
Related Tickets
This change is