material-components-web icon indicating copy to clipboard operation
material-components-web copied to clipboard

Question: Change the size of the gutter of an MDC layout grid using a SASS Mixin

Open MrChriZ opened this issue 7 years ago • 3 comments

I've opened a StackOverflow question here: https://stackoverflow.com/questions/48102082/change-the-size-of-the-gutter-of-an-mdc-layout-grid-using-a-sass-mixin

It's not getting many views though so I hope you don't mind me asking here. What's the correct procedure for changing the gutter size with the SASS Mixins?

Thanks, Chris.

MrChriZ avatar Jan 05 '18 11:01 MrChriZ

mdc-layout-grid's Sass mixins are, frankly, a bit of a mess.

The reason the mixin doesn't appear to do anything is because it sets the correct property value, but then immediately overrides it with a CSS variable for browsers that support it.

However, we never update the value of the CSS variable, so modern browsers continue to render the inherited value instead.

E.g. (source):

// We could set --mdc-layout-grid-gutter-#{$size} to $gutter here...
grid-gap: $gutter;
grid-gap: var(--mdc-layout-grid-gutter-#{$size}, $gutter);

We should probably just nuke the CSS variables... They've been causing lots of issues like this.

acdvorak avatar Jan 18 '18 22:01 acdvorak

Is there any news on this one please? Seems to be bugged. We can't change the gutter size using the sass mixin.

drimlike avatar Aug 22 '19 09:08 drimlike

I'm currently seeing a similar issue as I can't override breakpoints, margins or gutters using the sass variables as expected.

daviddouglas-smarsh avatar Oct 19 '22 13:10 daviddouglas-smarsh