-
Notifications
You must be signed in to change notification settings - Fork 51
Allow notifications and actions to specify a navigable URL #213
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
Conversation
@saschanaz @beverloo thoughts? |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
1 or 2 minor changes are fine but getting more starts to be annoying, especially if we get multiple review rounds... 😛 Should we also fold in some part of #204 here? Non-persistent notification with a URL certainly has a valid action to do even if the page is closed. |
(Interesting that we are currently not telling what action is invoked for non-persistent notifications, per the existing steps) |
A parallel question, is WebKit going to implement actions? |
|
Some extra questions:
|
|
Having a way to bound to a tab might affect the API usage quite a bit. Needing to open a tab all the time even if the site was already open would be a bit annoying. But perhaps you've had some other types of use cases in mind. In which way do you imagine one to use only the URL + new top level navigable? |
This feature is part of w3c/push-api#360 to enable fully declarative push notifications. Perhaps it should not be allowed for cc @beidson |
We should probably also consider not always opening a new tab for declarative push, btw. |
Yeah we'll think about it and are of course also happy to consider concrete proposals. I suspect that anything we decide to do can easily go on top of this, so I'm not sure I'd consider it blocking. |
Brady pointed out to me that we already reuse an existing tab if there is one. I don't think HTML has a good primitive for that, but I'll see about adjusting the wording to allow for that. Thanks for pointing it out! (I guess that raises the question as to whether there should be a feature to force a new window, but that's probably best deferred.) |
Hmmmm, in that case I would be interested to learn more about the tab selection algorithm. |
This introduces a new feature whereby push messages conforming to a certain JSON format directly create an end user notification and show it (possibly preceded by a new pushnotification event). In addition to showing a notification, the app badge can be updated as well. This builds on whatwg/notifications#213 which adds URL members to notifications. Exposing PushManager outside of service workers will be done in a separate change.
Hey Anne, this seems good to us. I've two thoughts -
Perhaps |
That seems a little premature? We could always overload once we establish we need the complexity, no? "Baby steps" and all that. |
If we are going to only ship one extra member, sure. I wonder we should make the tab selection optional if we are going to do an implementation detailed magic there though. |
Needed by the Notifications API: whatwg/notifications#213.
Now I'm confused, I was assuming that the new intention is to reuse the existing tabs, and the full URL comparison was accidental. It seems the intention is actually to reuse only if the URL is exactly the same of one of the existing tabs and open new tab for anything else. Not sure how that's strictly useful than just open new tab for everything for V1, given a lot of existing use cases assign a new URL for each notification because a notification frequently means there's a new content (e.g. Mastodon, Twitter, YouTube, Slack, Instagram, etc.. Chat apps may have higher frequency of having same URL but still with severely limited chance.) |
Needed by the Notifications API: whatwg/notifications#213.
This introduces a new feature whereby push messages conforming to a certain JSON format directly create an end user notification and show it (possibly preceded by a new pushnotification event). In addition to showing a notification, the app badge can be updated as well. This builds on whatwg/notifications#213 which adds URL members to notifications. Exposing PushManager outside of service workers will be done in a separate change.
This makes notifications more declarative by not requiring explicit handling of the clicks by the web application. This is part of the Declarative Web Push effort: w3c/push-api#360.
The full URL comparison is not accidental. On all Apple platforms, when you click a link outside the default browser (or run That seems like reasonable behavior for external links as part of v1 of this feature, but as other behavior is reasonable too and this is really the realm of user interfaces, the PR doesn't require an exact behavior, just that a navigation occurs. As we get more adoption and feature requests around this, we can certainly add some enhancements to this, such as your proposed |
This introduces a new feature whereby push messages conforming to a certain JSON format directly create an end user notification and show it (possibly preceded by an enhanced push event). In addition to showing a notification, the app badge can be updated as well. This builds on whatwg/notifications#213 which adds URL members to notifications. Exposing PushManager outside of service workers is handled by #393.
This introduces a new feature whereby push messages conforming to a certain JSON format directly create an end user notification and show it (possibly preceded by an enhanced push event). In addition to showing a notification, the app badge can be updated as well. This builds on whatwg/notifications#213 which adds URL members to notifications. Exposing PushManager outside of service workers is handled by #393.
Needed by the Notifications API: whatwg/notifications#213.
This introduces a new feature whereby push messages conforming to a certain JSON format directly create an end user notification and show it (possibly preceded by an enhanced push event). In addition to showing a notification, the app badge can be updated as well. This builds on whatwg/notifications#213 which adds URL members to notifications. Exposing PushManager outside of service workers is handled by #393.
@saschanaz let me reproduce your comment here since you commented on a resolved thread without reopening it:
The behavior we ship aligns with how links from elsewhere in the OS cause the browser to navigate today. It's what end users already expect and has not resulted in any issues with early adopters to our knowledge. I think it would also be fine to leave this implementation-defined for now and potentially give web developers more control over the exact behavior down the line. |
I couldn't reopen it, the unresolve button doesn't work for me, sorry. And I did not resolve it, so I wonder you can?
AH. AAH. I was confused about this statement while sitting in front of a Windows machine and then started thinking maybe this is macOS convention. And boom, that's true, if I click links on Mail app with the Safari as the default browser, then it works just as you described. But given Edge doesn't do that on Windows for example, I don't think we can apply that to every platform. So maybe we can allow always opening a new tab in a spec level, per the platform convention? |
Okay, I've gone back to the initial version of giving implementations more freedom and added encouragement to match platform conventions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with some nonblocking comments.
|
||
<ul> | ||
<li><p><a for=/>Navigate</a> an existing <a for=/>top-level traversable</a> within the user | ||
agent's <a for="user agent">top-level traversable set</a> to <var>navigationURL</var>. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But does Safari actually focus-and-navigate a tab? I think it just focuses a tab and does not navigate per what I see for the non-push external clicks. But I may be wrong.
Also does this need to say about focusing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It definitely navigates for me when I follow a link from a different app or run open https://github.com/whatwg/notifications/pull/213
. Just lost my initial comment trying that.
This introduces a new feature whereby push messages conforming to a certain JSON format directly create an end user notification and show it (possibly preceded by an enhanced push event). This builds on whatwg/notifications#213 which adds URL members to notifications. See #360 for further context.
This makes notifications more declarative by not requiring explicit handling of the clicks by the web application.
This change is part of a larger Declarative Web Push effort, but can hopefully land in isolation as a small incremental step toward that goal.
(See WHATWG Working Mode: Changes for more details.)
Preview | Diff