File tree Expand file tree Collapse file tree 2 files changed +12
-7
lines changed
Expand file tree Collapse file tree 2 files changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -19,13 +19,9 @@ describe('Chips', () => {
1919 beforeEach ( async ( ( ) => {
2020 TestBed . configureTestingModule ( {
2121 imports : [ MatChipsModule ] ,
22- declarations : [
23- BasicChip , SingleChip
24- ] ,
22+ declarations : [ BasicChip , SingleChip ] ,
2523 providers : [ {
26- provide : Directionality , useFactory : ( ) => {
27- return { value : dir } ;
28- }
24+ provide : Directionality , useFactory : ( ) => ( { value : dir } )
2925 } ]
3026 } ) ;
3127
@@ -281,6 +277,15 @@ describe('Chips', () => {
281277 expect ( chipNativeElement . getAttribute ( 'aria-disabled' ) ) . toBe ( 'true' ) ;
282278 } ) ;
283279
280+ it ( 'should make disabled chips non-focusable' , ( ) => {
281+ expect ( chipNativeElement . getAttribute ( 'tabindex' ) ) . toBe ( '-1' ) ;
282+
283+ testComponent . disabled = true ;
284+ fixture . detectChanges ( ) ;
285+
286+ expect ( chipNativeElement . getAttribute ( 'tabindex' ) ) . toBeFalsy ( ) ;
287+ } ) ;
288+
284289 } ) ;
285290 } ) ;
286291} ) ;
Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ export class MatBasicChip {
6868 exportAs : 'matChip' ,
6969 host : {
7070 'class' : 'mat-chip' ,
71- 'tabindex' : '-1' ,
71+ '[attr. tabindex] ' : 'disabled ? null : -1' ,
7272 'role' : 'option' ,
7373 '[class.mat-chip-selected]' : 'selected' ,
7474 '[attr.disabled]' : 'disabled || null' ,
You can’t perform that action at this time.
0 commit comments