16

When I receive a reply/tag on chat, the 'notification bubble' must be clicked in order to dismiss the message:

enter image description here

I have desktop notifications enabled, but however clicking the notification to go to the chat message does not dismiss it (from both within the same tab/window, and from other browser tabs):

enter image description here

Surely it'd make sense for the chat message to be dismissed when the desktop notification is clicked, but however I foresee some potential issues with this:

  • Not possible to act on when the user dismisses the notification
  • Not possible to distinguish between clicking 'X' (which we would assume the user doesn't want to mark the message as read) and clicking on the notification to dismiss it

Can the desktop notification automatically dismiss chat messages when clicked on?

  • 6
    This is a good feature request that I always forgot to post. I thought the second limitation can be solved, but seems it'll be hard since there's click event handler, but close is deprecated (Ref: MDN). Anyway, the current notification only focuses the browser when clicked, but doesn't highlight the particular reply. If by any way, it can "click" the notification bubble (use API, or... I dunno), then it should be perfect. – Meta Andrew T. Jun 5 '15 at 8:05
4
+250

This does seem like it should be possible, as the Notification onclick handler is supported by all major browsers except IE (which doesn't support desktop notifications at all, anyway).

As for your second concern, technically that shouldn't be a problem: there are separate onclick and onclose events, but unfortunately, onclose is no longer listed in the spec, so it may or may not be supported.

There's also a sticky attribute listed in the spec that might make your concern more relevant if included in a future version of the API, as currently Safari does not have a close button on notifications created this way; they will disappear in a few seconds, so it's a bit hazy as to when/how a particular notification was closed.

Did the user swipe the notification away, or did it just time out? Presumably, a "sticky" notification would remain on the screen in the way that these notifications currently do in Chrome and have a close button.

For now, though, using onclick should suffice. In my testing, the onclick event was only triggered when the user actually clicked on the notification to act on it (i.e. clicking the close button will not trigger the onclick handler). So, it would be safe to assume that if onclick is triggered, the chat notifications can be cleared (seems like DOM manipulation or a server call could take it from here).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .