Skip to content

fix(material/datepicker): incorrect appearance when used in MDC form field #23028

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 1 commit into from
Jun 22, 2021
Merged
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: 3 additions & 1 deletion src/material/datepicker/date-range-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,9 @@ export class MatDateRangeInput<D> implements MatFormFieldControl<DateRange<D>>,
// The datepicker module can be used both with MDC and non-MDC form fields. We have
// to conditionally add the MDC input class so that the range picker looks correctly.
if (_formField?._elementRef.nativeElement.classList.contains('mat-mdc-form-field')) {
_elementRef.nativeElement.classList.add('mat-mdc-input-element');
const classList = _elementRef.nativeElement.classList;
classList.add('mat-mdc-input-element');
classList.add('mat-mdc-form-field-control');
}

// TODO(crisbeto): remove `as any` after #18206 lands.
Expand Down