Skip to content

Commit 9dee466

Browse files
vanessanschmittandrewseguin
authored andcommitted
style(mdc chips) Fix clashing input and remove classes (#16561)
We have slightly different styles for the MDC versions of mat-chip-remove and mat-chip-input. Projects that import all angular material css are also getting the non-mdc chips css, which is applying the non-mdc styles to these elements. Add -mdc to mat-chip-remove and mat-chip-input classes in the mdc module to differentiate them. All the other mdc chip classes already contain -mdc for the same reason.
1 parent 6013036 commit 9dee466

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

src/material-experimental/mdc-chips/chip-icons.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ const _MatChipRemoveMixinBase:
9393
selector: '[matChipRemove]',
9494
inputs: ['disabled', 'tabIndex'],
9595
host: {
96-
'class': 'mat-chip-remove mat-mdc-chip-trailing-icon mdc-chip__icon mdc-chip__icon--trailing',
96+
'class':
97+
'mat-mdc-chip-remove mat-mdc-chip-trailing-icon mdc-chip__icon mdc-chip__icon--trailing',
9798
'[tabIndex]': 'tabIndex',
9899
'role': 'button',
99100
'(click)': 'interaction.next($event)',

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ let nextUniqueId = 0;
3434
selector: 'input[matChipInputFor]',
3535
exportAs: 'matChipInput, matChipInputFor',
3636
host: {
37-
'class': 'mat-chip-input mat-input-element',
37+
'class': 'mat-mdc-chip-input mat-input-element',
3838
'(keydown)': '_keydown($event)',
3939
'(blur)': '_blur()',
4040
'(focus)': '_focus()',

src/material-experimental/mdc-chips/chip-remove.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ describe('Chip Remove', () => {
3131
}));
3232

3333
describe('basic behavior', () => {
34-
it('should apply the `mat-chip-remove` CSS class', () => {
34+
it('should apply the `mat-mdc-chip-remove` CSS class', () => {
3535
let buttonElement = chipNativeElement.querySelector('button')!;
3636

37-
expect(buttonElement.classList).toContain('mat-chip-remove');
37+
expect(buttonElement.classList).toContain('mat-mdc-chip-remove');
3838
});
3939

4040
it('should start MDC exit animation on click', () => {

src/material-experimental/mdc-chips/chips.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,6 @@
4848
// Add styles for the matChipInputFor input element.
4949
$mat-chip-input-width: 150px;
5050

51-
input.mat-chip-input {
51+
input.mat-mdc-chip-input {
5252
flex: 1 0 $mat-chip-input-width;
5353
}

0 commit comments

Comments
 (0)