RESOLVED FIXED248309
notification.close() not working
https://bugs.webkit.org/show_bug.cgi?id=248309
Summary notification.close() not working
Andy
Reported 2022-11-24 08:11:01 PST
Calling notification.close() (from both inside and outside a service worker) doesn't remove the notification(s) Use case: Removing notifications that no longer apply to user, for instance if they have visited a page the notification would take them to. To replicate - Have a notification in Notification Centre created by current site - get all notifications, then call notification.close() From a window: navigator.serviceWorker.ready.then(function(registration) { registration.getNotifications().then((notifications) => { for (let notification of notifications) { notification.close() } }) }) From within a service worker: self.registration.getNotifications().then((notifications) => { for (let notification of notifications) { notification.close() } }) Expected results The notification in notification is removed Actual result The notification remains
Attachments
Radar WebKit Bug Importer
Comment 1 2022-11-26 14:45:24 PST
youenn fablet
Comment 2 2022-11-28 05:23:43 PST
EWS
Comment 3 2022-11-29 01:36:33 PST
Committed 257108@main (d02120f1bc06): <https://commits.webkit.org/257108@main> Reviewed commits have been landed. Closing PR #6856 and removing active labels.
ik
Comment 4 2024-07-18 02:16:41 PDT
I just stumbled upon this ticket because I was about to file a new bug for notification.close() not working. This ticket is marked ad RESOLVED FIXED in 2022, but it's still not working on the latest iOS version (17.5 or so?) AFAICT, it has never worked. I've been testing it with every new iOS release since 16.4.
ik
Comment 5 2025-04-02 01:02:15 PDT
A recent iOS release (18.0?) fixed the issue. The close() method now actually dismisses the notification.
Note You need to log in before you can comment on or make changes to this bug.