[Layout Grid] Include an ability for mdc-layout-grid to look at the container width instead of the window width to determine if breakpoint needs to be changed
See original GitHub issueI’ve noticed that mdc-layout-grid
looks at the window width when determines which breakpoint to use.
It means that if a component with mdc-layout-grid
is part of some other container the breakpoint is not switched until the width of the browser window (more precisely the viewport) crosses the breakpoint width boundary. This leads to the mdc-layout-grid
not changing layout even though the container width that it is enclosed in is less than a breakpoint target width.
This demonstrates what I mean.
<table>
<tr>
<td style="min-width: 220px;">left</td>
<td>
<div class="mdc-layout-grid">
<div class="mdc-layout-grid__inner">
<div
class="mdc-layout-grid__cell--span-2-desktop mdc-layout-grid__cell--span-4-tablet mdc-layout-grid__cell--span-4-phone"
style="height: 150px; background-color: red;"
></div>
<div
class="mdc-layout-grid__cell--span-2-desktop mdc-layout-grid__cell--span-4-tablet mdc-layout-grid__cell--span-4-phone"
style="height: 150px; background-color: red;"
></div>
<div
class="mdc-layout-grid__cell--span-2-desktop mdc-layout-grid__cell--span-4-tablet mdc-layout-grid__cell--span-4-phone"
style="height: 150px; background-color: red;"
></div>
<div
class="mdc-layout-grid__cell--span-2-desktop mdc-layout-grid__cell--span-4-tablet mdc-layout-grid__cell--span-4-phone"
style="height: 150px; background-color: red;"
></div>
<div
class="mdc-layout-grid__cell--span-2-desktop mdc-layout-grid__cell--span-4-tablet mdc-layout-grid__cell--span-4-phone"
style="height: 150px; background-color: red;"
></div>
<div
class="mdc-layout-grid__cell--span-2-desktop mdc-layout-grid__cell--span-4-tablet mdc-layout-grid__cell--span-4-phone"
style="height: 150px; background-color: red;"
></div>
</div>
</div>
</td>
<td style="min-width: 220px;">
right
</td>
</tr>
</table>
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Responsive layout grid - Material Design
The Material Design responsive layout grid adapts to screen size and orientation. This UI guidance includes a flexible grid that ensures consistency across ......
Read more >Responsive layout grid - Hussain Almoamen
The Material Design responsive layout grid adapts to screen size and ... layout can use breakpoints to determine if the layout needs to...
Read more >material/layout-grid
A grid is a container that consists of a group of cells. Grid can define its own max-width or designate its columns to...
Read more >Change the size of the gutter of an MDC layout grid using a ...
Cross-post from discussion on MDC Web's GitHub issue tracker: The reason the mixin doesn't appear to do anything is because it sets the ......
Read more >Responsive Components: a Solution to the Container ...
Container queries is a proposal that would allow web developers to style DOM elements based on the size of a containing element rather...
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 FreeTop 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
Top GitHub Comments
Thank you!
Hi, Thanks for reaching out. This component was implemented according to Material Design guidelines to account for viewport widths only. As Simon suggested, for your use case, it might be best to use a solution that polyfills element queries.