question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItĀ collects links to all the places you might be looking at while hunting down a tough bug.

And, if youā€™re still stuck at the end, weā€™re happy to hop on a call to see how we can help out.

[Grid] .MuiGrid-grid-md class does not load when the page is loaded at xs width

See original GitHub issue
  • This is not a v0.x issue.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior šŸ¤”

Grid should be responsive even when the page is loaded as xs width.

Current Behavior šŸ˜Æ

Grid is not responsive.

Steps to Reproduce šŸ•¹

The bug is reproducible here: http://ec2-18-217-230-111.us-east-2.compute.amazonaws.com/diagnoses/Ondineā€™s curse (It is a live (changing, in development) site, but Iā€™ll try to keep it in the state so the bug is reproducible for some time.)

  1. Shrink the page to xs size (<600px width).
  2. Click on the ā€œDark Diagnosisā€ in the header. (This will go to another route, thus unmounting the components from the current route.)
  3. Widen the page above xs size (>600px width).
  4. Click on some image (for example the one that was open initially), thus going to the single image route. (If you clicked on the image that was open in the beginning you will go to the initial route).

The image and description will stay at 100% width. The image and description should shrink to 50% width each, and they should fit in the same row. Gridā€™s sm class was not applied to the component.

The following code describes the mentioned components on the above given website:

        <Grid container>
            <Grid item xs={12} sm={6}>
                <img src={diagnosisData.imageUrl} width='100%' height='100%' style={{borderRadius: '5%'}}/>
            </Grid>
            <Grid item xs={12} sm={6}>
                {descriptionComponent}
            </Grid>
        </Grid>

Context šŸ”¦

The bug does not occur always. After it occurs, changing the width by 1px the .MuiGrid-grid-sm class gets applied to the elements correctly and the elements shrink.

Your Environment šŸŒŽ

Tech Version
Material-UI v4.2.0
React 16.8.6
Browser Chrome 75.0
TypeScript No

(Couldnā€™t reproduce in FF)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:22 (22 by maintainers)

github_iconTop GitHub Comments

2reactions
crorafcommented, Jul 29, 2020

Iā€™ve tested a bit. The issue happens until v81, and does not happen at v83. So it is confirmed that itā€™s been fixed in Chrome somewhere in that period.

0reactions
crorafcommented, Jul 28, 2020

@mbrookes It would be at least good that someone else confirms that this doesnā€™t appear any more on latest Chrome, as the issue is not of consistent nature.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Grid] .MuiGrid-grid-md class does not load when the page is ...
Grid should be responsive even when the page is loaded as xs width. Current Behavior. Grid is not responsive. Steps to Reproduce. The...
Read more >
Full Width Material-UI Grid not working as it should
sm Defines the number of grids the component is going to use. It's applied for the sm breakpoint and wider screens if not...
Read more >
React Grid component - Material UI - MUI
The Material Design responsive layout grid adapts to screen size and orientation, ensuring consistency across layouts.
Read more >
Guide to the MUI grid system - LogRocket Blog
The grid system in Material Design is visually balanced. It adapts to screen sizes and orientation, ensuring a consistent layout across pages.
Read more >
A Simple Guide to Material UI Grids | DMC, Inc.
To use Material UI Grids, we can start with wrapping our 'Hooray ... width, so an xs={6} will continue to occupy about 50%...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found