-
Notifications
You must be signed in to change notification settings - Fork 115
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] notification click event not firing if it opens a new tab #1132
Conversation
Fix issue where OneSignal.Notifications.addEventListener('click', function() {}) would not fire when a notification was clicked that opens a new page. Fixed by calling fireStoredNotificationClicks when a click listener is added which checks the indexDb for any notification clicks that were not processed for a specific URL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just 1 nit and fix linting errors. Other than that, looks good.
const stub = test.stub( | ||
EventHelper, | ||
'fireStoredNotificationClicks', | ||
null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an optional argument. And I don't believe this function returns anything
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah good catch, removed the null
.
2a4587c
to
901f308
Compare
Description
1 Line Summary
Fix notification click event not firing if it opens a new tab.
Details
The internal
fireStoredNotificationClicks()
function was not called to fire any pending click events whenOneSignal.Notifications.addEventListener('click', function() {})
is called.Validation
Tests
Tested on Chrome 119 on Window 11, testing both "focus" and "navigate" options for notification open behavior.
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
Tested click Behavior Exact:
Tested click behavior Focus:
Info
Checklist
Related Tickets
This change is