diff --git a/src/material/chips/chip-row.html b/src/material/chips/chip-row.html index 218fdfc181d9..83c8607c2450 100644 --- a/src/material/chips/chip-row.html +++ b/src/material/chips/chip-row.html @@ -7,28 +7,25 @@ - - - - - - - + + + + + - - - - + + + + - - + diff --git a/src/material/chips/chip-row.spec.ts b/src/material/chips/chip-row.spec.ts index d90a6bbd3570..c6c44ee47d5e 100644 --- a/src/material/chips/chip-row.spec.ts +++ b/src/material/chips/chip-row.spec.ts @@ -256,14 +256,16 @@ describe('MDC-based Row Chips', () => { return chipNativeElement.querySelector('.mat-chip-edit-input')!; } - it('should set the role of the primary action based on whether it is editable', () => { + it('should set the role of the primary action to gridcell', () => { testComponent.editable = false; fixture.detectChanges(); - expect(primaryAction.hasAttribute('role')).toBe(false); + expect(primaryAction.getAttribute('role')).toBe('gridcell'); testComponent.editable = true; fixture.detectChanges(); - expect(primaryAction.getAttribute('role')).toBe('button'); + // Test regression of bug where element is mislabeled as a button role. Element that does not perform its + // action on click event is not a button by ARIA spec (#27106). + expect(primaryAction.getAttribute('role')).toBe('gridcell'); }); it('should not delete the chip on DELETE or BACKSPACE', () => { @@ -346,7 +348,7 @@ describe('MDC-based Row Chips', () => { fixture.detectChanges(); const primaryGridCell = (fixture.nativeElement as HTMLElement).querySelector( - '[role="gridcell"].mdc-evolution-chip__cell--primary .mat-mdc-chip-action', + '[role="gridcell"].mdc-evolution-chip__cell--primary.mat-mdc-chip-action', ); expect(primaryGridCell) .withContext('expected to find the grid cell for the primary chip action') diff --git a/src/material/chips/chip.scss b/src/material/chips/chip.scss index 1253c1e5c960..edfd708032cb 100644 --- a/src/material/chips/chip.scss +++ b/src/material/chips/chip.scss @@ -118,7 +118,7 @@ // Ensures that the trailing icon is pushed to the end if the chip has a set width. .mdc-evolution-chip__cell--primary { - width: 100%; + flex-basis: 100%; } // This element can be placed on a `button` node which usually has some user agent styles.