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

Updates the native and custom checks to use flexbox #25184

Closed
wants to merge 2 commits into from
Closed
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
13 changes: 7 additions & 6 deletions scss/_custom-forms.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@

.custom-control {
position: relative;
display: block;
min-height: (1rem * $line-height-base);
padding-left: $custom-control-gutter;
display: flex;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had the same display: flex in my pull request, but now I'm trying to remember the reason for even having it. Does removing this cause any negative effect? Or does it have a purpose for inclusion? I fiddled around a bit and didn't see a reason for just leaving the display property off... what do you think?

}

.custom-control-inline {
Expand Down Expand Up @@ -57,16 +55,15 @@
// Build the custom controls out of psuedo-elements.

.custom-control-label {
display: flex;
margin-bottom: 0;

// Background-color and (when enabled) gradient
&::before {
position: absolute;
top: (($line-height-base - $custom-control-indicator-size) / 2);
left: 0;
display: block;
width: $custom-control-indicator-size;
height: $custom-control-indicator-size;
margin-top: (($line-height-base - $custom-control-indicator-size) / 2);
pointer-events: none;
content: "";
user-select: none;
Expand All @@ -87,6 +84,10 @@
background-position: center center;
background-size: $custom-control-indicator-bg-size;
}

&:not(:empty)::before {
margin-right: $custom-control-gutter;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.custom-control-label will never be empty because of the before and after pseudo-elements. It will always have margin-right.

}
}


Expand Down
9 changes: 2 additions & 7 deletions scss/_forms.scss
Original file line number Diff line number Diff line change
Expand Up @@ -207,14 +207,12 @@ select.form-control-lg {

.form-check {
position: relative;
display: block;
padding-left: $form-check-input-gutter;
display: flex;
}

.form-check-input {
position: absolute;
margin-top: $form-check-input-margin-y;
margin-left: -$form-check-input-gutter;
margin-right: $form-check-input-gutter;

&:disabled ~ .form-check-label {
color: $text-muted;
Expand All @@ -228,15 +226,12 @@ select.form-control-lg {
.form-check-inline {
display: inline-flex;
align-items: center;
padding-left: 0; // Override base .form-check
margin-right: $form-check-inline-margin-x;

// Undo .form-check-input defaults and add some `margin-right`.
.form-check-input {
position: static;
margin-top: 0;
margin-right: $form-check-inline-input-margin-x;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should $form-check-inline-input-margin-x be consolidated with $form-check-input-gutter?
If not, should the default value in _variables be changed so that they are equal?

margin-left: 0;
}
}

Expand Down
4 changes: 2 additions & 2 deletions scss/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ $input-transition: border-color .15s ease-in-out, box-shado

$form-text-margin-top: .25rem !default;

$form-check-input-gutter: 1.25rem !default;
$form-check-input-gutter: .5rem !default;
$form-check-input-margin-y: .3rem !default;
$form-check-input-margin-x: .25rem !default;

Expand All @@ -436,7 +436,7 @@ $input-group-addon-color: $input-color !default;
$input-group-addon-bg: $gray-200 !default;
$input-group-addon-border-color: $input-border-color !default;

$custom-control-gutter: 1.5rem !default;
$custom-control-gutter: .5rem !default;
$custom-control-spacer-x: 1rem !default;

$custom-control-indicator-size: 1rem !default;
Expand Down