Skip to content

Commit 1fc1106

Browse files
committed
fix(material/form-field): update text field styles for better alignment and overflow handling
Fixes #28743
1 parent ba5cf3d commit 1fc1106

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/material/form-field/_mdc-text-field-structure-overrides.scss

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ $_enable-form-field-will-change-reset: true;
5151
.mat-mdc-form-field:not(.mat-form-field-disabled) .mat-mdc-floating-label.mdc-floating-label {
5252
// Style the cursor the same way as the rest of the input
5353
cursor: inherit;
54+
width: inherit;
5455
}
5556

5657
// Reset the height that MDC sets on native input elements. We cannot rely on their
@@ -117,7 +118,9 @@ $_enable-form-field-will-change-reset: true;
117118
.mat-form-field-disabled .mdc-text-field__input {
118119
@include vendor-prefixes.input-placeholder {
119120
@include token-utils.use-tokens(
120-
tokens-mat-form-field.$prefix, tokens-mat-form-field.get-token-slots()) {
121+
tokens-mat-form-field.$prefix,
122+
tokens-mat-form-field.get-token-slots()
123+
) {
121124
@include token-utils.create-token-slot(color, disabled-input-text-placeholder-color);
122125
}
123126
}

src/material/form-field/_mdc-text-field-structure.scss

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@
233233
}
234234

235235
.mdc-notched-outline & {
236-
text-overflow: clip;
236+
text-overflow: ellipsis;
237237
}
238238

239239
.mdc-notched-outline--upgraded & {
@@ -398,6 +398,7 @@
398398
@include token-utils.use-tokens($outlined-slots...) {
399399
.mdc-text-field--outlined .mdc-notched-outline & {
400400
$shape-var: token-utils.get-token-variable(container-shape);
401+
--mat-form-field-notch-max-width: 180px; // set width same as .mat-mdc-form-field-infix See form-field.scss
401402
max-width: min(
402403
var(--mat-form-field-notch-max-width, 100%),
403404
calc(100% - max(12px, #{$shape-var}) * 2)
@@ -611,7 +612,9 @@
611612
}
612613

613614
.mdc-line-ripple::after {
614-
transition: transform 180ms $timing-curve, opacity 180ms $timing-curve;
615+
transition:
616+
transform 180ms $timing-curve,
617+
opacity 180ms $timing-curve;
615618
}
616619

617620
.mat-mdc-form-field-hint-wrapper,

0 commit comments

Comments
 (0)