Skip to content

fix(material/form-field): label not truncated in fill appearance #26353

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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 @@ -20,6 +20,19 @@
border: none;
}

// TODO(crisbeto): port this fix over into MDC
// MDC only sets a max-width form outlined form fields, but we need it
// for filled ones as well in order for the text truncation to work.
.mat-form-field-appearance-fill {
.mdc-floating-label {
max-width: 100%;
}

.mdc-floating-label--float-above {
max-width: 133.33%;
}
}

.mat-mdc-form-field .mat-mdc-floating-label.mdc-floating-label {
// In order to ensure proper alignment of the floating label, we reset its line-height.
// The line-height is not important as the element is absolutely positioned and only has one
Expand Down Expand Up @@ -135,5 +148,4 @@
.mat-mdc-text-field-wrapper::before {
content: none;
}

}