[Masonry] Incorrect number of columns behaviour when items have dynamic height
See original GitHub issueDuplicates
- I have searched the existing issues
Latest version
- I have tested the latest version
Current behavior 😯
If any of the items of the masonry can grow in height, instead of re-accommodate all items to preserve the number of columns, it is creating new columns. Please refer to this sandbox:
In the sandbox demo, if you start opening the accordions, you’ll see the undesired columns being created.
Expected behavior 🤔
The masonry should always stick to the number of columns passed in the columns
prop.
Steps to reproduce 🕹
Context 🔦
Trying to use the masonry to displays different cards and controls in a dashboard that could have different (and possibly growing) heights.
Your environment 🌎
`npx @mui/envinfo`
System:
OS: macOS 12.0.1
Binaries:
Node: 14.18.0 - ~/.nvm/versions/node/v14.18.0/bin/node
Yarn: 1.22.15 - ~/.nvm/versions/node/v14.18.0/bin/yarn
npm: 6.14.15 - ~/.nvm/versions/node/v14.18.0/bin/npm
Browsers:
Chrome: 95.0.4638.69 (this browser was used)
Edge: Not Found
Firefox: 91.0.2
Safari: 15.1
npmPackages:
@emotion/react: ^11.5.0 => 11.5.0
@emotion/styled: ^11.3.0 => 11.3.0
@mui/core: 5.0.0-alpha.54
@mui/icons-material: ^5.1.0 => 5.1.0
@mui/lab: ^5.0.0-alpha.54 => 5.0.0-alpha.54
@mui/material: ^5.1.0 => 5.1.0
@mui/private-theming: 5.1.0
@mui/styled-engine: 5.1.0
@mui/styles: ^5.1.0 => 5.1.0
@mui/system: 5.1.0
@mui/types: 7.1.0
@mui/utils: 5.1.0
@types/react: ^17.0.34 => 17.0.34
react: ^17.0.2 => 17.0.2
react-dom: ^17.0.2 => 17.0.2
typescript: ^4.4.4 => 4.4.4
Issue Analytics
- State:
- Created 2 years ago
- Reactions:6
- Comments:11 (6 by maintainers)
Top Results From Across the Web
[Masonry] Incorrect number of columns behaviour when ...
The incorrect # of columns comes from an insufficient masonry height because this computation didn't run. It didn't run because resize observer ...
Read more >Jquery Masonry height issue - css
I have a simple masonry grid. When it loads the .content class is visible. When you reload the items flow in to each...
Read more >Masonry layout - CSS: Cascading Style Sheets | MDN
This example includes an item which has positioning for columns. Items with definite placement are placed before the masonry layout happens.
Read more >Masonry · Options - David DeSandro
Sets the width of the container to fit the available number of columns, based the size of container's parent element. When enabled, you...
Read more >Posts | Beaver Builder Knowledge Base
Columns layout lets you choose number of columns. Masonry. Posts are displayed in columns but vertical spacing is fit to the height of...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thank you so much @hbjORbj - legend!
Thx for picking this up so quickly again after a period of staleness! @hbjORbj