aboutsummaryrefslogtreecommitdiff
path: root/scss/forms
diff options
context:
space:
mode:
authorLouis-Maxime Piton <[email protected]>2024-06-13 03:39:23 +0200
committerGitHub <[email protected]>2024-06-12 18:39:23 -0700
commitb522441901040496664ba64beab37dbacd317881 (patch)
treec7085fcd722c0730332b0084d92a54150f83df30 /scss/forms
parent093276119d807c5f7c77b860c1e1dafff1a46b69 (diff)
downloadbootstrap-b522441901040496664ba64beab37dbacd317881.tar.xz
bootstrap-b522441901040496664ba64beab37dbacd317881.zip
Floating labels: Fix `max-width` and `background-color` (#39720)
* Fix `max-width` * Fix label background color * Add new visual test: floating label * Fix `npm run docs` --------- Co-authored-by: Julien Déramond <[email protected]>
Diffstat (limited to 'scss/forms')
-rw-r--r--scss/forms/_floating-labels.scss30
1 files changed, 16 insertions, 14 deletions
diff --git a/scss/forms/_floating-labels.scss b/scss/forms/_floating-labels.scss
index 1a6efc0a4..b36650588 100644
--- a/scss/forms/_floating-labels.scss
+++ b/scss/forms/_floating-labels.scss
@@ -14,6 +14,7 @@
top: 0;
left: 0;
z-index: 2;
+ max-width: 100%;
height: 100%; // allow textareas
padding: $form-floating-padding-y $form-floating-padding-x;
overflow: hidden;
@@ -58,16 +59,6 @@
> .form-select {
~ label {
transform: $form-floating-label-transform;
-
- &::after {
- position: absolute;
- inset: $form-floating-padding-y ($form-floating-padding-x * .5);
- z-index: -1;
- height: $form-floating-label-height;
- content: "";
- background-color: $input-bg;
- @include border-radius($input-border-radius);
- }
}
}
// Duplicated because `:-webkit-autofill` invalidates other selectors when grouped
@@ -76,6 +67,21 @@
transform: $form-floating-label-transform;
}
}
+ > textarea:focus,
+ > textarea:not(:placeholder-shown) {
+ ~ label::after {
+ position: absolute;
+ inset: $form-floating-padding-y ($form-floating-padding-x * .5);
+ z-index: -1;
+ height: $form-floating-label-height;
+ content: "";
+ background-color: $input-bg;
+ @include border-radius($input-border-radius);
+ }
+ }
+ > textarea:disabled ~ label::after {
+ background-color: $input-disabled-bg;
+ }
> .form-control-plaintext {
~ label {
@@ -86,9 +92,5 @@
> :disabled ~ label,
> .form-control:disabled ~ label { // Required for `.form-control`s because of specificity
color: $form-floating-label-disabled-color;
-
- &::after {
- background-color: $input-disabled-bg;
- }
}
}