Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Required steps for closing a notification are incompatible with some platforms #109

Open
hober opened this issue Oct 11, 2017 · 3 comments · May be fixed by #111
Open

Required steps for closing a notification are incompatible with some platforms #109

hober opened this issue Oct 11, 2017 · 3 comments · May be fixed by #111

Comments

@hober
Copy link

hober commented Oct 11, 2017

On some platforms when the user dismisses an app's notification without activating it, the app is never woken up to be told that. No client-side app code is run in this case; the app is only woken up upon activation of the notification.

Could the wording of §2.8 Closing a notification be loosened to allow for such cases?

@beverloo
Copy link
Member

+1, because platforms are all over the place.

On Mac OS X activation of the Close button can be observed by reading that activationType is set to none. That's a best effort method that gives the developer something.

I believe that the Action Center on Windows issues an event when the notification dismisses to the notification center, but not when it moves away from there.

On Android the event is not comprehensive too, given that there are reasons for notifications to close that won't cause the app to trigger, notably reboots or other apps clearing the list.

@hober, would adding a phrase like "if the platform is able to" satisfy this issue? The event has significant value, even if its functionality is best effort.

@hober
Copy link
Author

hober commented Oct 11, 2017

@beverloo That's definitely an improvement, but I'm not sure "if the platform is able to" goes far enough. Sites need to code to this API under the assumption that their code will not run when a notification is closed, since that's the case on several platforms. I'd prefer the text say that UAs MAY run these steps, with perhaps a Note saying it's quite unlikely on some platforms.

@beverloo
Copy link
Member

I'm fine with that, as it reflects reality. I'll send a PR tomorrow.

beverloo added a commit to beverloo/notifications that referenced this issue Oct 20, 2017
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 whatwg#109
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants