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:
8484 CanDisableCtor &
8585 HasTabIndexCtor &
8686 typeof MatChipRemoveBase =
87- mixinTabIndex ( mixinDisabled ( MatChipRemoveBase ) ) ;
87+ mixinTabIndex ( mixinDisabled ( MatChipRemoveBase ) , 0 ) ;
8888
8989/**
9090 * Directive to remove the parent chip when the trailing icon is clicked or
@@ -95,9 +95,11 @@ const _MatChipRemoveMixinBase:
9595 *
9696 * Example:
9797 *
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+ * ```
101103 */
102104@Directive ( {
103105 selector : '[matChipRemove]' ,
@@ -109,6 +111,9 @@ const _MatChipRemoveMixinBase:
109111 'role' : 'button' ,
110112 '(click)' : 'interaction.next($event)' ,
111113 '(keydown)' : 'interaction.next($event)' ,
114+
115+ // We need to remove this explicitly, because it gets inherited from MatChipTrailingIcon.
116+ '[attr.aria-hidden]' : 'null' ,
112117 }
113118} )
114119export 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', () => {
7878
7979 expect ( chipNativeElement . classList . contains ( 'mdc-chip--exit' ) ) . toBe ( false ) ;
8080 } ) ;
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+
8189 } ) ;
8290} ) ;
8391
You can’t perform that action at this time.
0 commit comments