-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
[Hidden] Remove component #26135
[Hidden] Remove component #26135
Conversation
@material-ui/core: parsed: -0.51% 😍, gzip: -0.63% 😍 |
paper: classes.paper, | ||
}} | ||
variant="permanent" | ||
sx={{ display: { xs: 'none', lg: 'block' } }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: Assuming we just want to migrate from <Hidden lgDown />
. Do we need lg: 'block'
here? To me it isn't clear what the display is above lg
or why we even need to differentiate between above and below lg
.
Documentation for this is lacking so whatever is the takeway, I'll incorporate into the docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I eventually found out how these works from the docs and it seems to me that { xs: 'none', lg: 'block' }
is not equivalent to lgDown
if the screen width is below xs
.
Wouldn't { display: 'none', lg: { display: 'none' }}
actually be equivalent?
Though maybe lg
isn't recognized and we would need { [theme.breakpoints.down('lg')]: { display: 'none' }
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting feedback, xs
is meant to be width: 0px
but it's not very clear. I wonder how we could fix this. I have seen some name it differently, like base
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for
{ [theme.breakpoints.down('lg')]: { display: 'none' } }
it's much more clear. Otherwise, I personally have hard time to follow what will be the end result.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe, my point was more, if I see lgDown
, I would be able to immediately replace it with:
{ [theme.breakpoints.down('lg')]: { display: 'none' } }
without thinking about it... 🤷 Otherwise, it would require some mental exercise 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not add support for props like xxDown
and xxUp
in the sx
prop? It would translate nicely with the props of Hidden
.
Interesting feedback, xs is meant to be width: 0px but it's not very clear. I wonder how we could fix this. I have seen some name it differently, like base.
base
would be great.
I'm biased, I'm used to thinking "mobile-first", hence why sx={{ display: { xs: 'none', lg: 'block' } } reads naturally to me.
For me, it's not natural. We have a dilemma between users that think mobile-first and desktop-first.
{ [theme.breakpoints.down('lg')]: { display: 'none' } }
I changing to this as I think it's more readable. However, I can't use it outside a component, like here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anyway, not a blocker, I think it's personal preference, I wouldn't change the code to be honest. @eps1lon can we resolve?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Migration is important. Please don't just handwave these things. Existing users and their path forward is critical to trust.
This is a general frustration I have where we constantly add new features completely ignoring that a feature has inherent cost associated with it. But as soon as we discuss interactions with other features, the feature is discarded.
People can customize breakpoints. The current migration path breaks in those customization scenarios. So whatever we do suggest as a migration either needs to actually be equivalent. Or justify why we ignore custom breakpoints. Which would be odd considering we just improved them with module augmentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Custom breakpoints is interesting. It looks like we forgot
mobile: 0
in https://material-ui.com/customization/breakpoints/#custom-breakpoints 😅 - Maybe we can open an issue to rename
xs
intobase
for v6? And maybe even remove it from the breakpoint theme structure. - @m4theushw do you want to comment on the
xxDown
alternative on [system] Allow max-width breakpoint instead of min-width #25846? It seems to be the same topic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we feel we are removing the component prematurely, we could only deprecate it, and dive deeper in the migration for v6.
paper: classes.paper, | ||
}} | ||
variant="permanent" | ||
sx={{ display: { xs: 'none', lg: 'block' } }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Custom breakpoints is interesting. It looks like we forgot
mobile: 0
in https://material-ui.com/customization/breakpoints/#custom-breakpoints 😅 - Maybe we can open an issue to rename
xs
intobase
for v6? And maybe even remove it from the breakpoint theme structure. - @m4theushw do you want to comment on the
xxDown
alternative on [system] Allow max-width breakpoint instead of min-width #25846? It seems to be the same topic.
How to replace |
<Box display={{ xs: 'none', md: 'block' }} /> |
Maybe we should update the changelog to show this example as well, or at least the migration guide. |
It looks like everyone who wants to migrate to the new version will have to create their own version of this component, otherwise they will rewrite the hiding of elements throughout the project, which entails a lot of edits, even in my not very large project. Is this the final decision to remove |
@missi2402 It's coming back as deprecated in #26408 |
@oliviertassinari Thanks for the link! |
This reverts commit 2b50b0f.
Breaking changes
[Hidden] Removed in favor of using the
sx
prop or theuseMediaQuery
hook.Use the
sx
prop to replaceimplementation="css"
:Use the
useMediaQuery
hook to replaceimplementation="js"
:Part of #20012
Closes #19704
Preview: https://deploy-preview-26135--material-ui.netlify.app/