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

Question: Is there a way to keep the snackbar on the page? #2811

Closed
DavidLGoldberg opened this issue Jan 6, 2016 · 13 comments
Closed

Question: Is there a way to keep the snackbar on the page? #2811

DavidLGoldberg opened this issue Jan 6, 2016 · 13 comments
Labels
support: question Community support but can be turned into an improvement

Comments

@DavidLGoldberg
Copy link

If a user clicks anywhere on the page (not the snackbar), this currently closes the snackbar. Is there a way to prevent this?

Thanks! (Great project btw!)

@oliviertassinari
Copy link
Member

The snackbar is controlled by the open property in the latest release. So yes, and that's straigthforward.

@mbrookes
Copy link
Member

mbrookes commented Jan 6, 2016

@DavidLGoldberg I don't think you can use autoHideDuration, but not have it close when you click outside the Snackbar. If that's the issue, you would need to create your own timer to control open.

@DavidLGoldberg
Copy link
Author

Hmm, ok interesting. Not that crucial at the moment for me. Thanks!

@oliviertassinari

This comment has been minimized.

@DavidLGoldberg
Copy link
Author

Ah, I tried to do the onRequestClose, didn't look deep enough thanks!

@DavidLGoldberg
Copy link
Author

Would some kind of preventDefault()? or return false be the trick here? Not exactly sure how to use it. (I'm a react n00b unfortunately)

@oliviertassinari

This comment has been minimized.

@mbrookes
Copy link
Member

mbrookes commented Jan 6, 2016

Yes, you can. onRequestClose is called with an additional parameter: reason.

Oh, that's good to know. That needs to be documented...

@DavidLGoldberg
Copy link
Author

Thanks so much for the lightning fast help guys 👍

@oliviertassinari oliviertassinari added the docs Improvements or additions to the documentation label Jan 6, 2016
@oliviertassinari
Copy link
Member

That needs to be documented...

I agree, let's wait #2417 to be resolved before closing this issue.

@mbrookes
Copy link
Member

mbrookes commented Jan 6, 2016

I've updated the docs in #2813, which can always be used as the text for #2417 if that gets resolved.

@TimAstier

This comment has been minimized.

@yatrix7
Copy link

yatrix7 commented Jan 23, 2020

I couldn't get this working with onRequestClose.

I believe this is just onClose now. From the docs:

function(event: object, reason: string) => void
event: The event source of the callback.
reason: Can be: "timeout" (autoHideDuration expired), "clickaway".

@oliviertassinari oliviertassinari added support: question Community support but can be turned into an improvement and removed docs Improvements or additions to the documentation labels Jan 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
support: question Community support but can be turned into an improvement
Projects
None yet
Development

No branches or pull requests

5 participants