Open rj33 opened 8 years ago
You may take a look at what I did : http://codepen.io/jfily/pen/Bjvxyp
The notification spec is unrelated to toasts and snackbars. The Snackbar spec states specifically to only show one at a time.
The notification MD spec is talking about OS level notifications. This is not something web sites are capable of building on their own. However, the web itself offers a notification API that fulfills this need (however with limited browser support.) It also is not something we are capable of re-styling or manipulating.
We could look into doing a site-level notification UI. Guidance from the MD team would be required for positioning of notifications since the spec currently provides no guidance on that for web apps.
Thanks @jfily , that looks like a good starting point.
@garbee, yes. I also hadn't noticed it was labeled 'Android only' (not sure how, it was fairly prominent at the top of the page!). It is interesting that this form of notification is seen as android only given I think that type of multiple stacked notification probably works best on desktop, and can be a little cumbersome on mobile (which I guess is why we have the 'one per page' toast and snackbar components). It would be great if this could be considered part of the library at some point, on desktop, I think the 'allow multiple notifications' use case is probably quite common.
Well, notifications are OS-level so cross-apps. So they want to provide consistency there for those developers looking into how to build their stuff to look good with other peoples stuff. App-level notifications, that is what Snackbar is for. Nice simple alerts that something has happened.
Not wanting to nitpick, and perhaps I'm mis-interpreting , but I don't really read that section of the MD spec as OS-level only stuff. In fact they open with 'Notifications inform your app’s users about relevant and timely events in your app.' 'timely events in your app' makes it sound like that section is also addressing app-level notifications, but of a different type (or a different way) than that addressed by Snackbar/Toast. In fact the Snackbar component's section of the spec suggests Toast's themselves are primarily for system level messaging (which I assume is equivalent to OS-level?) with "Android also provides a toast, primarily used for system messaging."
Updated for Android N notifications
=> https://codepen.io/jfily/pen/eBEYmZ
No real specs but followed this : https://material.google.com/patterns/notifications.html#notifications-anatomy-of-a-notification
@jfily Can't find any specs for MD desktop app notifications either. Your CP looks good tho !
Just use the Notifications API
The snackbar/toast seem explicitly designed as a 'only one on screen at a time'. It would be nice if we could get library support for this part of the MD spec: https://www.google.com/design/spec/patterns/notifications.html
Which requires multiple toast/snackbar like panels to be present on screen at once.