ampproject / ampproject/amphtml
Push Notifications not working in Firefox due to user gesture requirement
- 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.

### 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
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