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

Anchor 'center' not working on screens under 960px #192

Closed
jtraaraujo opened this issue Nov 12, 2019 · 8 comments
Closed

Anchor 'center' not working on screens under 960px #192

jtraaraujo opened this issue Nov 12, 2019 · 8 comments

Comments

@jtraaraujo
Copy link

jtraaraujo commented Nov 12, 2019

Anchor 'center' should center the snackbar, but it doesn't in smaller screens.
EDIT: Screens between 600 and 960px ('sm' right?)

Expected Behavior

Center the Snackbar

Current Behavior

Stays on the left of the screen (top or bottom) - tested on Chrome and Firefox

Steps to Reproduce

Just go to the examples page: https://iamhosseindhv.com/notistack/demos#material-props and try centered snackbars (top or bottom)

First time I post a bug in GitHub so I hope it's good enough :)

Thanks
bug

@iamhosseindhv
Copy link
Owner

Thanks @jtraaraujo . ❤️
This is intentional. Notistack tries to replicate Material-UI snackbars and they try to follow material specifications.

Although I'm not sure if this is explicitly specified in material design, I think it's a good design decision.

@jtraaraujo
Copy link
Author

Hi @iamhosseindhv ! Thanks for your reply!

I did check on Material UI website and they don't force the Snackbar to the left in 'sm' screens (600 to 960px).

Tested here: https://material-ui.com/components/snackbars/#positioned-snackbars
Don't forget we are talking about centered Snackbars (top or bottom)

Also, Material specifications explicitly say:
Avoid placing snackbars flushed to one edge of the layout.
(https://material.io/components/snackbars/#placement)

So I guess if you're following Material UI's approach, the Snackbar should stay centered.

Thanks!

@piehouserat
Copy link

I also ran into this today, I think notistack should not differ in behaviour to how things work in material ui as it threw me for a while until i realised this was by design

@oliviertassinari
Copy link
Contributor

@piehouserat Make sure you are using the latest version. I suspect it was solved. Do you have a reproduction?

@piehouserat
Copy link

I just installed it today, package.json shows 0.9.7 which is the latest version on npm, a reproduction of the problem can actually be produced on the notistack website by going to https://iamhosseindhv.com/notistack/demos#material-props setting the horizontal anchor origin to center and adjusting the viewport to less than 960px

have added some extra jss to fix the problem for now but hopefully this can be removed soon when fixed

@oliviertassinari
Copy link
Contributor

Ah right, thanks for the detailed step. Well, It does sound like a small bug :).

@lucasturci
Copy link

Hello guys, got this same problem today. It seems like the bug wasn't solved yet. Any updates?
@piehouserat , can you share the JSS you used to fix as a workaround?

@iamhosseindhv
Copy link
Owner

The problem you're facing @lucasturci is #367 which has been fixed in the latest version (1.0.6).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants