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

[Snackbar] Fix hidden overlay blocking interactions regression #25739

Merged
merged 4 commits into from
Apr 15, 2021

Conversation

MieleVL
Copy link
Contributor

@MieleVL MieleVL commented Apr 12, 2021

@mui-pr-bot
Copy link

mui-pr-bot commented Apr 12, 2021

Details of bundle changes

Generated by 🚫 dangerJS against 0187f80

Copy link
Member

@oliviertassinari oliviertassinari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is breaking the display on mobile:

Screenshot 2021-04-12 at 18 16 41

Spec: https://material.io/components/snackbars

@oliviertassinari oliviertassinari changed the title [snackbar] Improve styles (#25737) [Snackbar] Fix hidden overlay blocking interactions regression Apr 12, 2021
@oliviertassinari oliviertassinari added bug 🐛 Something doesn't work component: snackbar This is the name of the generic UI component, not the React module! labels Apr 12, 2021
@mnajdova
Copy link
Member

mnajdova commented Apr 12, 2021

This is breaking the display on mobile

Then we can probably keep the { right: 8, left: 8 } and unset them under [theme.breakpoints.up('sm')] instead of completely removing them.

@mnajdova
Copy link
Member

@MieleVL you would also need these changes

diff --git a/packages/material-ui/src/Snackbar/Snackbar.js b/packages/material-ui/src/Snackbar/Snackbar.js
index 25ba683a1e..aa60de00eb 100644
--- a/packages/material-ui/src/Snackbar/Snackbar.js
+++ b/packages/material-ui/src/Snackbar/Snackbar.js
@@ -68,6 +68,8 @@ const SnackbarRoot = experimentalStyled(
     ...(styleProps.anchorOrigin.horizontal === 'left' && { justifyContent: 'flex-start' }),
     ...(styleProps.anchorOrigin.horizontal === 'right' && { justifyContent: 'flex-end' }),
     [theme.breakpoints.up('sm')]: {
+      right: 'unset',
+      left: 'unset',
       ...(styleProps.anchorOrigin.vertical === 'top' ? { top: 24 } : { bottom: 24 }),
       ...(styleProps.anchorOrigin.horizontal === 'center' && center),
       ...(styleProps.anchorOrigin.horizontal === 'left' && { left: 24, right: 'auto' }),

@oliviertassinari
Copy link
Member

oliviertassinari commented Apr 12, 2021

Since it's a regression from #25142, another alternative would be to add the CSS properties we changed in the PR. cc @m4theushw

@oliviertassinari
Copy link
Member

oliviertassinari commented Apr 12, 2021

If we want to restore the pre-migration to emotion effort (and fix the issue), it seems enough to apply this on HEAD:

diff --git a/packages/material-ui/src/Snackbar/Snackbar.js b/packages/material-ui/src/Snackbar/Snackbar.js
index b71e6d535c..8903eb3d3a 100644
--- a/packages/material-ui/src/Snackbar/Snackbar.js
+++ b/packages/material-ui/src/Snackbar/Snackbar.js
@@ -56,8 +56,8 @@ const SnackbarRoot = experimentalStyled(
   const left = { justifyContent: 'flex-start' };
   const top3 = { top: 24 };
   const bottom3 = { bottom: 24 };
-  const right3 = { right: 24 };
-  const left3 = { left: 24 };
+  const right3 = { left: 'auto', right: 24 };
+  const left3 = { left: 24, right: 'auto' };
   const center = {
     left: '50%',
     right: 'auto',

which is almost the initial proposal (without the simplification, yes, we can remove the indirections 👍)

Copy link
Member

@mnajdova mnajdova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@oliviertassinari oliviertassinari dismissed their stale review April 13, 2021 09:42

regression on mobile fixed

@mnajdova mnajdova merged commit 6b74f9c into mui:next Apr 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: snackbar This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Snackbar] Spans the entire screen width
5 participants