notifications
notifications copied to clipboard
Add a warning about the reliability of the notificationclose event
Not all platforms dispatch an event to the applications (e.g. the user
agent) when a notification is dismissed, or only do so in a subset of
cases. This means that the notificationclose event is a best-effort
event. It adds significant value to the developer, as dismissal is a
powerful (yet complicated) signal, so user agents should still make an
effort to support it where they can.
Fixes #109
PTAL @annevk and @hober
I decided to not amend the algorithm as the user agent would not know about either closing of the notification, or about whether it was user triggered, when this situation arises. Does that sound reasonable?
The proposed change leaves the RFC 2119 MUST in place, though. I don't think this change is sufficient.
Just changing the MUST to SHOULD imposes a significant change to the list of notifications concept. It would either be stale as deletion becomes optional (how will getNotifications() behave?) or would become a shared responsibility between the user agent and the underlying platform notification center. The second option means that the user agent will be aware of closed notifications, just not in a timely manner.
Instead, maybe we should somehow rephrase the event dispatching section (2.8.2.) to be limited to situations where the UA does know in a timely manner?
Maybe something like:
When a notification is closed, either by the underlying notification platform or by the user, and the underlying notification platform exposes notification closure, the close steps for it must be run.