File tree 4 files changed +10
-7
lines changed
src/material-experimental
4 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,6 @@ export const MAT_BUTTON_HOST = {
38
38
// Add a class that applies to all buttons. This makes it easier to target if somebody
39
39
// wants to target all Material buttons.
40
40
'[class.mat-mdc-button-base]' : 'true' ,
41
- 'class' : 'mat-mdc-focus-indicator' ,
42
41
} ;
43
42
44
43
/** Configuration for the ripple animation. */
@@ -154,7 +153,6 @@ export const MAT_ANCHOR_HOST = {
154
153
// an unthemed version. If color is undefined, apply a CSS class that makes it easy to
155
154
// select and style this "theme".
156
155
'[class.mat-unthemed]' : '!color' ,
157
- 'class' : 'mat-mdc-focus-indicator' ,
158
156
// Add a class that applies to all buttons. This makes it easier to target if somebody
159
157
// wants to target all Material buttons.
160
158
'[class.mat-mdc-button-base]' : 'true' ,
Original file line number Diff line number Diff line change 5
5
6
6
< span class ="mdc-button__label "> < ng-content > </ ng-content > </ span >
7
7
8
+ <!--
9
+ The indicator can't be directly on the button, because MDC uses ::before for high contrast
10
+ indication and it can't be on the ripple, because it has a border radius and overflow: hidden.
11
+ -->
12
+ < div class ="mat-mdc-focus-indicator "> </ div >
13
+
8
14
< ng-content select =".material-icons[iconPositionEnd], mat-icon[iconPositionEnd] ">
9
15
</ ng-content >
10
16
Original file line number Diff line number Diff line change @@ -264,7 +264,7 @@ describe('MDC-based MatButton', () => {
264
264
[ ...fixture . debugElement . nativeElement . querySelectorAll ( 'a, button' ) ] ;
265
265
266
266
expect ( buttonNativeElements
267
- . every ( element => element . classList . contains ( ' mat-mdc-focus-indicator') ) ) . toBe ( true ) ;
267
+ . every ( element => ! ! element . querySelector ( '. mat-mdc-focus-indicator') ) ) . toBe ( true ) ;
268
268
} ) ;
269
269
} ) ;
270
270
Original file line number Diff line number Diff line change @@ -235,10 +235,8 @@ $mat-typography-level-mappings: (
235
235
// values are necessary to ensure that the focus indicator is sufficiently
236
236
// contrastive and renders appropriately.
237
237
238
- .mat-mdc-focus-indicator.mdc-button ::before ,
239
- .mat-mdc-focus-indicator.mdc-chip ::before ,
240
- .mat-mdc-focus-indicator.mdc-fab ::before ,
241
- .mat-mdc-focus-indicator.mdc-icon-button ::before {
238
+ .mat-mdc-button-base .mat-mdc-focus-indicator ::before ,
239
+ .mat-mdc-focus-indicator.mdc-chip ::before {
242
240
margin : $mat-focus-indicator-border-width * -2 ;
243
241
}
244
242
@@ -260,6 +258,7 @@ $mat-typography-level-mappings: (
260
258
.mdc-checkbox__native-control :focus ~ .mat-mdc-focus-indicator ::before ,
261
259
.mat-mdc-slide-toggle-focused .mat-mdc-focus-indicator ::before ,
262
260
.mat-mdc-radio-button.cdk-focused .mat-mdc-focus-indicator ::before ,
261
+ .mat-mdc-button-base :focus .mat-mdc-focus-indicator ::before ,
263
262
264
263
// For all other components, render the focus indicator on focus.
265
264
.mat-mdc-focus-indicator :focus ::before {
You can’t perform that action at this time.
0 commit comments