Problem/Motivation
On Android Chrome, tapping a Web Push notification opens the target URL, including in PWA standalone mode, but the notification remains visible in the system notification tray/shade. The bug is most consistently reproduced when the notification link targets a PWA, where clients.openWindow() behaviour differs from a regular browser tab.
Steps to reproduce
Prerequisites: drupal/pwa module installed and enabled; site configured as a PWA.
- Install the site as a PWA on Android Chrome and subscribe to Web Push.
- Trigger a push that uses
service_worker_notification.js(showNotification+notificationclickhandler). - Tap the notification when it appears.
- Observe: the PWA opens the URL, but the notification entry remains in the notification tray/shade until dismissed manually.
- Maintainer review for any platform-specific concerns.
- Confirm behaviour on Android Chrome (primary target) and desktop Chrome.
Proposed resolution
In js/service_worker_notification.js, inside the notificationclick listener, call event.notification.close() before event.waitUntil(...) so the notification is explicitly dismissed when the user acts on it. This matches common Service Worker / Notification API guidance for click handling.
Remaining tasks
User interface changes
None (behavioural fix only).
API changes
None.
Data model changes
None.
| Comment | File | Size | Author |
|---|---|---|---|
| web_push-fix-persistent-notification-bug.patch | 465 bytes | oscarclement |
Comments