Skip to content

Commit 500d235

Browse files
authored
fix(material-experimental/mdc-input): input should not inherit parent classnames (#18180)
1 parent 149669e commit 500d235

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/material-experimental/mdc-input/input.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ import {MatInput as BaseMatInput} from '@angular/material/input';
2020
exportAs: 'matInput',
2121
host: {
2222
'class': 'mat-mdc-input-element mdc-text-field__input',
23+
// The BaseMatInput parent class adds `mat-input-element` and `mat-form-field-autofill-control`
24+
// to the CSS classlist, but this should not be added for this MDC equivalent input.
25+
'[class.mat-form-field-autofill-control]': 'false',
26+
'[class.mat-input-element]': 'false',
2327
'[class.mat-input-server]': '_isServer',
2428
'[class.mat-mdc-textarea-input]': '_isTextarea()',
2529
// Native input properties that are overwritten by Angular inputs need to be synced with

src/material/input/input.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ const _MatInputMixinBase: CanUpdateErrorStateCtor & typeof MatInputBase =
7171
/**
7272
* @breaking-change 8.0.0 remove .mat-form-field-autofill-control in favor of AutofillMonitor.
7373
*/
74-
'class': 'mat-input-element mat-form-field-autofill-control',
74+
'[class.mat-form-field-autofill-control]': 'true',
75+
'[class.mat-input-element]': 'true',
7576
'[class.mat-input-server]': '_isServer',
7677
// Native input properties that are overwritten by Angular inputs need to be synced with
7778
// the native input element. Otherwise property bindings for those don't work.

0 commit comments

Comments
 (0)