Skip to content

Commit

Permalink
style(mdc chips) Fix clashing input and remove classes (angular#16561)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
vanessanschmitt authored and jelbourn committed Jul 22, 2019
1 parent d9977bd commit 701302d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/material-experimental/mdc-chips/chip-icons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ const _MatChipRemoveMixinBase:
selector: '[matChipRemove]',
inputs: ['disabled', 'tabIndex'],
host: {
'class': 'mat-chip-remove mat-mdc-chip-trailing-icon mdc-chip__icon mdc-chip__icon--trailing',
'class':
'mat-mdc-chip-remove mat-mdc-chip-trailing-icon mdc-chip__icon mdc-chip__icon--trailing',
'[tabIndex]': 'tabIndex',
'role': 'button',
'(click)': 'interaction.next($event)',
Expand Down
2 changes: 1 addition & 1 deletion src/material-experimental/mdc-chips/chip-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ let nextUniqueId = 0;
selector: 'input[matChipInputFor]',
exportAs: 'matChipInput, matChipInputFor',
host: {
'class': 'mat-chip-input mat-input-element',
'class': 'mat-mdc-chip-input mat-input-element',
'(keydown)': '_keydown($event)',
'(blur)': '_blur()',
'(focus)': '_focus()',
Expand Down
4 changes: 2 additions & 2 deletions src/material-experimental/mdc-chips/chip-remove.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ describe('Chip Remove', () => {
}));

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

expect(buttonElement.classList).toContain('mat-chip-remove');
expect(buttonElement.classList).toContain('mat-mdc-chip-remove');
});

it('should start MDC exit animation on click', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/material-experimental/mdc-chips/chips.scss
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@
// Add styles for the matChipInputFor input element.
$mat-chip-input-width: 150px;

input.mat-chip-input {
input.mat-mdc-chip-input {
flex: 1 0 $mat-chip-input-width;
}

0 comments on commit 701302d

Please sign in to comment.