Skip to content

Commit 637e64d

Browse files
committed
Fix Grid items/content alignment when just a single value is set (#569)
Intentionally use longhand properties because the custom property fallback mechanism evaluates `initial` values as empty. That makes the other value of the shorthand property unexpectedly used for both axes.
1 parent d532592 commit 637e64d

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/components/Grid/Grid.module.scss

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
// `--rui-local-<PROPERTY>: var(--rui-local-<PROPERTY>-sm, var(--rui-local-<PROPERTY>-xs, <INITIAL FALLBACK>))`
2020
//
2121
// 2. Apply custom property value that is defined within current breakpoint, see 1.
22+
//
23+
// 3. Intentionally use longhand properties because the custom property fallback mechanism evaluates `initial` values as
24+
// empty. That makes the other value of the shorthand property unexpectedly used for both axes.
2225

2326
@use "sass:map";
2427
@use "../../styles/tools/spacing";
@@ -35,8 +38,12 @@
3538
grid-template-rows: var(--rui-local-rows); // 2.
3639
grid-auto-flow: var(--rui-local-auto-flow); // 2.
3740
grid-gap: var(--rui-local-row-gap) var(--rui-local-column-gap); // 2.
38-
place-content: var(--rui-local-align-content) var(--rui-local-justify-content); // 2.
39-
place-items: var(--rui-local-align-items) var(--rui-local-justify-items); // 2.
41+
// stylelint-disable declaration-block-no-redundant-longhand-properties -- 3.
42+
align-content: var(--rui-local-align-content); // 2.
43+
align-items: var(--rui-local-align-items); // 2.
44+
justify-content: var(--rui-local-justify-content); // 2.
45+
justify-items: var(--rui-local-justify-items); // 2.
46+
// stylelint-enable declaration-block-no-redundant-longhand-properties
4047
}
4148

4249
// stylelint-disable-next-line selector-max-universal -- Reset any previously added margins.

0 commit comments

Comments
 (0)