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', () => {
19
19
beforeEach ( async ( ( ) => {
20
20
TestBed . configureTestingModule ( {
21
21
imports : [ MatChipsModule ] ,
22
- declarations : [
23
- BasicChip , SingleChip
24
- ] ,
22
+ declarations : [ BasicChip , SingleChip ] ,
25
23
providers : [ {
26
- provide : Directionality , useFactory : ( ) => {
27
- return { value : dir } ;
28
- }
24
+ provide : Directionality , useFactory : ( ) => ( { value : dir } )
29
25
} ]
30
26
} ) ;
31
27
@@ -281,6 +277,15 @@ describe('Chips', () => {
281
277
expect ( chipNativeElement . getAttribute ( 'aria-disabled' ) ) . toBe ( 'true' ) ;
282
278
} ) ;
283
279
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
+
284
289
} ) ;
285
290
} ) ;
286
291
} ) ;
Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ export class MatBasicChip {
68
68
exportAs : 'matChip' ,
69
69
host : {
70
70
'class' : 'mat-chip' ,
71
- 'tabindex' : '-1' ,
71
+ '[attr. tabindex] ' : 'disabled ? null : -1' ,
72
72
'role' : 'option' ,
73
73
'[class.mat-chip-selected]' : 'selected' ,
74
74
'[attr.disabled]' : 'disabled || null' ,
You can’t perform that action at this time.
0 commit comments