material-ui icon indicating copy to clipboard operation
material-ui copied to clipboard

[Hidden] mdDown is shown when width is md on implementation=css

Open superwese opened this issue 8 years ago • 6 comments

Regarding the docs components with property mdDown should not be shown:

If true, screens this size and down will be hidden.

  • [x] I have searched the issues of this repository and believe that this is not a duplicate.

maybe related to #8172 and #6767

Expected Behavior

<Hidden mdDown> components must not be displayed when withStyles() returns width: "md"

Current Behavior

Content is shown. Neither Safari's nor Chrome's "inspect" shows that the media query for class MuiHiddenCss-mdDown is matched.

Steps to Reproduce (for bugs)

https://codesandbox.io/s/7wlyw4y8m0

  1. change window size in project view

Your Environment

Tech Version
Material-UI 1.0.0-beta.2
React 16.2.0
browser Safari 11.0.1, Chrome 64.0.3278.0

If you confirm that this is a bug, please give me a hint where to fix it.

superwese avatar Dec 06 '17 00:12 superwese

I confirm, the JS implementation is correct, not the CSS one 😱 .

oliviertassinari avatar Dec 06 '17 22:12 oliviertassinari

Wait, no. It's the other way around! The JS implementation is not correct. It's should be inclusive=false so both isWidthDown(breakpoint) and theme.breakpoint.down(breakpoint) behave identically. https://github.com/mui-org/material-ui/blob/d81f1a94b0534b476e7ed5eb992e347c301f1513/src/utils/withWidth.js#L34

oliviertassinari avatar Dec 06 '17 22:12 oliviertassinari

I do agree to #9420 in terms that the css behaviour is more intuitive, but regarding the docs the js implementation is now not correct. I’ll look at the withWidth and may send a PR.

superwese avatar Dec 06 '17 23:12 superwese

@oliviertassinari @superwese Are you sure it's fixed? If you look at the examples on https://material-ui.com/layout/hidden/ it seems wrong i.e. it's actually doing the opposite of what's written. 'Breakpoint Up' for example should hide the the children above a certain breakpoint. The exact opposite is the case i.e. it's shown. Same for the 'Breakpoint Down' example.

evdama avatar Nov 12 '18 21:11 evdama

@markusgattol We should probably change the demo, it's confusing!

oliviertassinari avatar Nov 12 '18 21:11 oliviertassinari

It is. If what's shown on this page is actually correct then it's explained/shown in a way that makes you think it's the inverse what's written vs what the demo shows.

evdama avatar Nov 12 '18 21:11 evdama