-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Request: Method for closing the snackbar #1466
Comments
Thanks for filing this feature request. It does strike me as odd that we have an API for I also suspect it might be a good idea to provide both options - just hide the snackbar, or hide and clear its queue. |
I'm not sure but shouldn't this be done by the destroy method? In your case, each view could have it's own snackbar which you destroy when the view is closed. I though calling destroy would immediately remove all open snackbars and prevent new snackbars being shown. However, currently the only thing that happens when calling destroy is the eventHandler of the snackbar action button being removed. But I can be very wrong with my idea of the destroy method. A small example app with show and destroy implemented: https://typescript-jg9n7i.stackblitz.io |
### Issues fixed * Fixes #4005 (via new `mdc-snackbar-viewport-margin()` mixin) * Fixes #3981 * Fixes #2916 (via new `MDCSnackbar:closing` and `MDCSnackbar:closed` events) * Fixes #2628 * Fixes #1466 (via new `close()` method) * Fixes #1398 * Fixes #1258 * Fixes #11 (the label now expands indefinitely to fit the text) * Refs #2813 ### Screenshots ![Baseline without action button](https://user-images.githubusercontent.com/409245/49956261-a080ca80-feb9-11e8-8287-b7e805344115.png) ![Baseline with action button](https://user-images.githubusercontent.com/409245/49956109-4a138c00-feb9-11e8-9213-3241fa86a1b8.png) ![Stacked layout](https://user-images.githubusercontent.com/409245/49956173-6a434b00-feb9-11e8-8a03-2e58ccc8f763.png) BREAKING CHANGE: Snackbar's DOM and APIs have changed to match the latest design guidelines. See the Snackbar documentation for more information.
Feature Request
When using the snack bar component in a SPA website, it would be useful if there was a method to call that would instantly hide (w/ animation) the snackbar (if it is currently showing) and remove any messages that might be in the queue. I would call this when the user navigates to a new view of the app and as such has decided messages from the current view are not of interest. Having messages shown/popup in the destination view just causes confusion.
The text was updated successfully, but these errors were encountered: