ampproject / ampproject/amphtml

Push Notifications not working in Firefox due to user gesture requirement

Open
#34,564 4 comments 0 reactions 0 assignees View on GitHub
P2: Soon Stale Type: Bug WG: components
Dominant language
JavaScript
Stars
14.9k
Forks
4.1k
PR merge metrics
No merged PRs in 30d

Description

### Description

Due to Firefox's user-gesture requirement described [here](https://developer.mozilla.org/en-US/docs/Web/API/Push_API/Best_Practices#browser_mitigations), AMP push notifications are currently broken on Firefox sites.

When attempting to subscribe in Firefox, you will see the popup flash. This is due to the window opening and immediately attempting to trigger the native notification prompt. However, since this is currently being done programmatically, the prompt fails and the window gets closed.

![May-26-2021 12-41-22](https://user-images.githubusercontent.com/11739227/119706575-c5feb600-be1f-11eb-8e64-af2f32c6bc4d.gif)

### Reproduction Steps

1. Open [the demo site](https://amp.dev/documentation/examples/components/amp-web-push/preview/?format=websites) in Firefox
2. Attempt to subscribe to notifications

### Relevant Logs

_No response_

### Browser(s) Affected

Firefox

### OS(s) Affected

_No response_

### Device(s) Affected

_No response_

### AMP Version Affected

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the amp-web-push demo site in Firefox and reproduce the subscription flow described in the issue. Trace the amp-web-push implementation responsible for opening the window and triggering the native notification prompt, then verify that subscribing no longer closes the window or fails because of Firefox's user-gesture requirement.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.