Skip to content

bug(service-worker): ClickActions only working (reliable) for default #52172

@angelaki

Description

@angelaki

Which @angular/* package(s) are the source of the bug?

service-worker

Is this a regression?

Yes

Description

I'm sending the following notification via WebPush to the Angular SW:

{
	"notification": {
		"title": "Title",
		"body": "Body",
		"icon": "/assets/images/logo/logo-192x192.png",
		"badge": "/assets/images/logo/logo-72x72.png",
		"data": {
			"onActionClick": {
				"default": {
					"operation": "navigateLastFocusedOrOpen",
					"url": "/link1"
				},
				"link2": {
					"operation": "navigateLastFocusedOrOpen",
					"url": "/link2"
				}
			}
		},
		"actions": [
			{
				"action": "link2",
				"title": "Link 2"
			}
		]
	}
}

The default action always works: when pushing the notification, the last focues (or a new) window opens and navigates to the relative url. But when clicking the action button, the application only navigates, if it is opened / running already. If there is no active instance, the notification just closes and nothing happens.

After checking some more, I've noticed that it works with Chrome on Windows but doesn't on Android (Galaxy Flip, Android 13, Chrome 117.0.5938.153)

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

No response

Please provide the environment you discovered this bug in (run ng version)

Chrome on Windows WORKS!
Chrome (117.0.5938.153) does **NOT** work on Android (Galaxy Flip, Android 13)

Angular CLI: 16.0.0
Node: 16.20.0
Package Manager: npm 8.5.4
OS: win32 x64

Angular:
...

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.1600.0 (cli-only)
@angular-devkit/core         16.0.0 (cli-only)
@angular-devkit/schematics   16.0.0 (cli-only)
@schematics/angular          16.0.0 (cli-only)

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: service-workerIssues related to the @angular/service-worker package

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions