Skip to content

fix(material/form-field): update text field styles for better alignment and overflow handling #30716

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

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
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ $_enable-form-field-will-change-reset: true;
.mat-mdc-form-field:not(.mat-form-field-disabled) .mat-mdc-floating-label.mdc-floating-label {
// Style the cursor the same way as the rest of the input
cursor: inherit;
width: inherit;
}

// Reset the height that MDC sets on native input elements. We cannot rely on their
Expand Down Expand Up @@ -117,7 +118,9 @@ $_enable-form-field-will-change-reset: true;
.mat-form-field-disabled .mdc-text-field__input {
@include vendor-prefixes.input-placeholder {
@include token-utils.use-tokens(
tokens-mat-form-field.$prefix, tokens-mat-form-field.get-token-slots()) {
tokens-mat-form-field.$prefix,
tokens-mat-form-field.get-token-slots()
) {
@include token-utils.create-token-slot(color, disabled-input-text-placeholder-color);
}
}
Expand Down
7 changes: 5 additions & 2 deletions src/material/form-field/_mdc-text-field-structure.scss
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@
}

.mdc-notched-outline & {
text-overflow: clip;
text-overflow: ellipsis;
}

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

.mdc-line-ripple::after {
transition: transform 180ms $timing-curve, opacity 180ms $timing-curve;
transition:
transform 180ms $timing-curve,
opacity 180ms $timing-curve;
}

.mat-mdc-form-field-hint-wrapper,
Expand Down
Loading