File tree 2 files changed +24
-1
lines changed 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change 1
1
@import ' ../core/theming/palette' ;
2
2
@import ' ../core/theming/theming' ;
3
3
4
+ // Applies a focus style to an md-button-toggle element for each of the supported palettes.
5
+ @mixin _mat-button-toggle-focus-color ($theme ) {
6
+ $primary : map-get ($theme , primary );
7
+ $accent : map-get ($theme , accent );
8
+ $warn : map-get ($theme , warn );
9
+
10
+ & .mat-primary .mat-button-toggle-focus-overlay {
11
+ background-color : mat-color ($primary , 0.12 );
12
+ }
13
+
14
+ & .mat-accent .mat-button-toggle-focus-overlay {
15
+ background-color : mat-color ($accent , 0.12 );
16
+ }
17
+
18
+ & .mat-warn .mat-button-toggle-focus-overlay {
19
+ background-color : mat-color ($warn , 0.12 );
20
+ }
21
+ }
4
22
5
23
@mixin mat-button-toggle-theme ($theme ) {
6
24
$foreground : map-get ($theme , foreground );
7
25
$background : map-get ($theme , background );
8
26
9
27
.mat-button-toggle {
10
28
color : mat-color ($foreground , hint-text );
29
+
30
+ & .cdk-focused {
31
+ @include _mat-button-toggle-focus-color ($theme );
32
+ }
11
33
}
12
34
13
35
.mat-button-toggle-checked {
Original file line number Diff line number Diff line change @@ -333,6 +333,7 @@ export class MdButtonToggle implements OnInit {
333
333
@Optional ( ) toggleGroupMultiple : MdButtonToggleGroupMultiple ,
334
334
public buttonToggleDispatcher : UniqueSelectionDispatcher ,
335
335
private _renderer : Renderer ,
336
+ private _elementRef : ElementRef ,
336
337
private _focusOriginMonitor : FocusOriginMonitor ) {
337
338
this . buttonToggleGroup = toggleGroup ;
338
339
@@ -364,7 +365,7 @@ export class MdButtonToggle implements OnInit {
364
365
if ( this . buttonToggleGroup && this . _value == this . buttonToggleGroup . value ) {
365
366
this . _checked = true ;
366
367
}
367
- this . _focusOriginMonitor . registerElementForFocusClasses ( this . _inputElement . nativeElement , this . _renderer ) ;
368
+ this . _focusOriginMonitor . monitor ( this . _elementRef . nativeElement , this . _renderer , true ) ;
368
369
}
369
370
370
371
/** Unique ID for the underlying `input` element. */
You can’t perform that action at this time.
0 commit comments