Skip to content

fix(material-experimental/mdc-form-field): setup typography styles for form-fields #18480

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

Merged
Merged
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
4 changes: 4 additions & 0 deletions src/material-experimental/mdc-form-field/_mdc-form-field.scss
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,9 @@
@include mdc-floating-label-core-styles($query: $mat-typography-styles-query);
@include mdc-text-field-core-styles($query: $mat-typography-styles-query);
@include _mat-form-field-subscript-typography($config);

.mat-mdc-form-field {
@include mat-typography-level-to-styles($config, input);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@

// Unset the border set by MDC. We move the border (which serves as the Material Design
// text-field bottom line) into its own element. This is necessary because we want the
// bottom-line to span across the whole form-field (including prefixes and suffixes).
// Also we want to ensure that font styles are inherited for input elements. We want input
// text to align with surrounding text. Also font inheritance has been enabled in the non
// MDC-based implementation of the form-field too, so we need it for backwards compatibility.
// bottom-line to span across the whole form-field (including prefixes and suffixes). Also
// we ensure that font styles are inherited for input elements. We do this because inputs by
// default have explicit font styles from the user agent, and we set the desired font styles
// in the parent `mat-form-field` element (for better custom form-field control support).
.mat-mdc-input-element {
font: inherit;
border: none;
Expand Down