File tree Expand file tree Collapse file tree 2 files changed +17
-4
lines changed
src/material-experimental/mdc-chips Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -84,7 +84,7 @@ const _MatChipRemoveMixinBase:
84
84
CanDisableCtor &
85
85
HasTabIndexCtor &
86
86
typeof MatChipRemoveBase =
87
- mixinTabIndex ( mixinDisabled ( MatChipRemoveBase ) ) ;
87
+ mixinTabIndex ( mixinDisabled ( MatChipRemoveBase ) , 0 ) ;
88
88
89
89
/**
90
90
* Directive to remove the parent chip when the trailing icon is clicked or
@@ -95,9 +95,11 @@ const _MatChipRemoveMixinBase:
95
95
*
96
96
* Example:
97
97
*
98
- * `<mat-chip>
99
- * <mat-icon matChipRemove>cancel</mat-icon>
100
- * </mat-chip>`
98
+ * ```
99
+ * <mat-chip>
100
+ * <mat-icon matChipRemove>cancel</mat-icon>
101
+ * </mat-chip>
102
+ * ```
101
103
*/
102
104
@Directive ( {
103
105
selector : '[matChipRemove]' ,
@@ -109,6 +111,9 @@ const _MatChipRemoveMixinBase:
109
111
'role' : 'button' ,
110
112
'(click)' : 'interaction.next($event)' ,
111
113
'(keydown)' : 'interaction.next($event)' ,
114
+
115
+ // We need to remove this explicitly, because it gets inherited from MatChipTrailingIcon.
116
+ '[attr.aria-hidden]' : 'null' ,
112
117
}
113
118
} )
114
119
export class MatChipRemove extends _MatChipRemoveMixinBase implements CanDisable , HasTabIndex {
Original file line number Diff line number Diff line change @@ -78,6 +78,14 @@ describe('MDC-based Chip Remove', () => {
78
78
79
79
expect ( chipNativeElement . classList . contains ( 'mdc-chip--exit' ) ) . toBe ( false ) ;
80
80
} ) ;
81
+
82
+ it ( 'should not make the element aria-hidden when it is focusable' , ( ) => {
83
+ const buttonElement = chipNativeElement . querySelector ( 'button' ) ! ;
84
+
85
+ expect ( buttonElement . getAttribute ( 'tabindex' ) ) . toBe ( '0' ) ;
86
+ expect ( buttonElement . hasAttribute ( 'aria-hidden' ) ) . toBe ( false ) ;
87
+ } ) ;
88
+
81
89
} ) ;
82
90
} ) ;
83
91
You can’t perform that action at this time.
0 commit comments