Skip to content

Commit

Permalink
Revert "Use consistent padding for input and select elements"
Browse files Browse the repository at this point in the history
This reverts commit 8ecf026.
  • Loading branch information
theodorejb committed Aug 19, 2024
1 parent 8ecf026 commit e6d4be0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 16 deletions.
8 changes: 4 additions & 4 deletions scss/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1072,10 +1072,10 @@ $form-floating-height: add(3.5rem, $input-height-border) !defau
$form-floating-line-height: 1.375 !default;
$form-floating-padding-x: $input-padding-x !default;
$form-floating-padding-y: 1rem !default;
$form-floating-input-padding-t: 1.25rem !default;
$form-floating-input-padding-b: .25rem !default;
$form-floating-textarea-padding-t: 1.625rem !default;
$form-floating-textarea-padding-b: .625rem !default;
$form-floating-input-padding-t: 1.625rem !default;
$form-floating-input-padding-b: .625rem !default;
$form-floating-select-padding-t: 1.25rem !default;
$form-floating-select-padding-b: .25rem !default;
$form-floating-label-height: 1.5em !default;
$form-floating-label-opacity: .65 !default;
$form-floating-label-transform: scale(.85) translateY(-.5rem) translateX(.15rem) !default;
Expand Down
18 changes: 6 additions & 12 deletions scss/forms/_floating-labels.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
.form-floating {
--#{$prefix}form-floating-input-padding-t: #{$form-floating-input-padding-t};
--#{$prefix}form-floating-input-padding-b: #{$form-floating-input-padding-b};
position: relative;

> .form-control,
Expand Down Expand Up @@ -40,19 +38,19 @@

&:focus,
&:not(:placeholder-shown) {
padding-top: var(--#{$prefix}form-floating-input-padding-t);
padding-bottom: var(--#{$prefix}form-floating-input-padding-b);
padding-top: $form-floating-input-padding-t;
padding-bottom: $form-floating-input-padding-b;
}
// Duplicated because `:-webkit-autofill` invalidates other selectors when grouped
&:-webkit-autofill {
padding-top: var(--#{$prefix}form-floating-input-padding-t);
padding-bottom: var(--#{$prefix}form-floating-input-padding-b);
padding-top: $form-floating-input-padding-t;
padding-bottom: $form-floating-input-padding-b;
}
}

> .form-select {
padding-top: var(--#{$prefix}form-floating-input-padding-t);
padding-bottom: var(--#{$prefix}form-floating-input-padding-b);
padding-top: $form-floating-select-padding-t;
padding-bottom: $form-floating-select-padding-b;
}

> .form-control:focus,
Expand All @@ -71,10 +69,6 @@
}
> textarea:focus,
> textarea:not(:placeholder-shown) {
// textareas require additional top padding to prevent label from overlapping text,
// and additional bottom padding for when text is scrolled.
--#{$prefix}form-floating-input-padding-t: #{$form-floating-textarea-padding-t};
--#{$prefix}form-floating-input-padding-b: #{$form-floating-textarea-padding-b};
~ label::after {
position: absolute;
inset: $form-floating-padding-y ($form-floating-padding-x * .5);
Expand Down

0 comments on commit e6d4be0

Please sign in to comment.