Skip to content

Commit 5e5db1c

Browse files
committed
fix(textarea): fix label jumping and invalid borders
1 parent 2d93fbe commit 5e5db1c

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

src/components/textarea/themes/shared/textarea.material.scss

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ textarea {
3636
[part='label'] {
3737
position: absolute;
3838
transform-origin: top left;
39-
top: calc($input-top-padding - #{rem(2px)});
39+
inset-block-start: calc($input-top-padding - #{rem(2px)});
4040
padding-inline-end: rem(4px);
4141
transition:
4242
transform 150ms cubic-bezier(.4, 0, .2, 1),
@@ -47,7 +47,7 @@ textarea {
4747

4848
%label-filled {
4949
transform: translateY(0);
50-
top: calc(#{$input-top-padding} / 4);
50+
inset-block-start: calc(#{$input-top-padding} / 4);
5151
font-size: rem(12px);
5252
}
5353

@@ -86,9 +86,8 @@ textarea {
8686
}
8787
}
8888

89-
textarea:placeholder-shown + [part='notch'] [part='label'],
90-
textarea:placeholder-shown ~ [part='notch'] [part='label'],
91-
[part~='filled'] [part='notch'] [part='label'] {
89+
[part~='placeholder'] [part='label'],
90+
[part~='filled'] [part='label'] {
9291
@extend %label-filled;
9392
}
9493
}
@@ -250,7 +249,7 @@ textarea {
250249
[part~='container'][part~='filled'],
251250
[part~='container'][part~='placeholder'] {
252251
[part='notch'] {
253-
border-block-start-color: transparent;
252+
border-block-start:rem(2px) solid transparent;
254253
}
255254
}
256255

@@ -393,12 +392,16 @@ textarea {
393392
:host([invalid][outlined]:not([disabled]):focus-within) {
394393
[part='start'],
395394
[part='filler'],
396-
[part='end'] {
395+
[part='end'],
396+
[part='notch'] {
397397
border-color: var-get($theme, 'error-secondary-color');
398398
}
399+
}
399400

401+
:host([invalid][outlined]:not([disabled]):focus-within),
402+
:host([invalid][outlined]:not([disabled])) [part~='placeholder'] {
400403
[part='notch'] {
401-
border-block-end-color: var-get($theme, 'error-secondary-color');
404+
border-block-start-color: transparent;
402405
}
403406
}
404407

0 commit comments

Comments
 (0)