Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Grid items/content alignment when just a single value is set (#569) #570

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/components/Grid/Grid.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
// `--rui-local-<PROPERTY>: var(--rui-local-<PROPERTY>-sm, var(--rui-local-<PROPERTY>-xs, <INITIAL FALLBACK>))`
//
// 2. Apply custom property value that is defined within current breakpoint, see 1.
//
// 3. Intentionally use longhand properties because the custom property fallback mechanism evaluates `initial` values as
// empty. That makes the other value from the items/content pair unexpectedly used for both axes.

@use "sass:map";
@use "../../styles/tools/spacing";
Expand All @@ -35,8 +38,12 @@
grid-template-rows: var(--rui-local-rows); // 2.
grid-auto-flow: var(--rui-local-auto-flow); // 2.
grid-gap: var(--rui-local-row-gap) var(--rui-local-column-gap); // 2.
place-content: var(--rui-local-align-content) var(--rui-local-justify-content); // 2.
place-items: var(--rui-local-align-items) var(--rui-local-justify-items); // 2.
// stylelint-disable declaration-block-no-redundant-longhand-properties -- 3.
align-content: var(--rui-local-align-content); // 2.
align-items: var(--rui-local-align-items); // 2.
justify-content: var(--rui-local-justify-content); // 2.
justify-items: var(--rui-local-justify-items); // 2.
// stylelint-enable declaration-block-no-redundant-longhand-properties
}

// stylelint-disable-next-line selector-max-universal -- Reset any previously added margins.
Expand Down
8 changes: 7 additions & 1 deletion src/styles/tools/form-fields/_box-field-layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@
//
// 13. Label and field are vertically aligned to top (start) by default (see 10.). Vertical
// alignment of each block can be changed by theme configuration.
//
// 14. Intentionally use longhand properties because the custom property fallback mechanism evaluates `initial` values
// as empty. That makes the other value from the items/content pair unexpectedly used for both axes.

@use "../../settings/forms";
@use "../../settings/form-fields" as settings;
Expand Down Expand Up @@ -125,7 +128,10 @@

.field {
grid-area: field;
place-self: theme.$horizontal-field-vertical-alignment start; // 13. / 7.
// stylelint-disable declaration-block-no-redundant-longhand-properties -- 14.
align-self: theme.$horizontal-field-vertical-alignment; // 13.
justify-self: start; // 7.
// stylelint-enable declaration-block-no-redundant-longhand-properties
}
}
}
Expand Down