File tree Expand file tree Collapse file tree 3 files changed +43
-23
lines changed Expand file tree Collapse file tree 3 files changed +43
-23
lines changed Original file line number Diff line number Diff line change @@ -63,6 +63,10 @@ $md-mini-fab-padding: 8px !default;
63
63
& [disabled ] {
64
64
cursor : default ;
65
65
}
66
+
67
+ & .md-button-focus {
68
+ @include md-button-focus ();
69
+ }
66
70
}
67
71
68
72
// Applies styles to buttons with backgrounds: raised, fab, and mini-fab
@@ -85,11 +89,6 @@ $md-mini-fab-padding: 8px !default;
85
89
@include md-elevation (8 );
86
90
}
87
91
88
- & .md-button-focus {
89
- background-color : md-color ($md-foreground , base , 0.12 );
90
- @include md-button-theme (' background-color' , 600 );
91
- }
92
-
93
92
& [disabled ] {
94
93
box-shadow : none ;
95
94
}
@@ -110,8 +109,4 @@ $md-mini-fab-padding: 8px !default;
110
109
i , md-icon {
111
110
padding : $padding 0 ;
112
111
}
113
-
114
- & .md-button-focus {
115
- background-color : md-color ($md-accent , 600 );
116
- }
117
112
}
Original file line number Diff line number Diff line change 1
-
2
- // Applies specified coloring to three supported palettes
3
- @mixin md-button-theme ($property , $color : ' default' , $opacity : 1 ) {
1
+ /* * Applies a property to an md-button element for each of the supported palettes. */
2
+ @mixin md-button-theme ($property , $color : ' default' , $opacity : 1 ) {
4
3
& .md-primary {
5
4
#{$property } : md-color ($md-primary , $color , $opacity );
6
5
}
18
17
}
19
18
}
20
19
}
20
+
21
+ /* * Applies a focus style to an md-button element for each of the supported palettes. */
22
+ @mixin md-button-focus {
23
+ & ::after {
24
+ // The button spec calls for focus on raised buttons (and FABs) to be indicated with a
25
+ // black, 12% opacity shade over the normal color (for both light and dark themes).
26
+ // We do this by placing an :after psuedo-element with the appropriate shade over the button.
27
+ position : absolute ;
28
+ top : 0 ;
29
+ left : 0 ;
30
+ bottom : 0 ;
31
+ right : 0 ;
32
+ content : ' ' ;
33
+ background-color : rgba (black , 0.12 );
34
+ border-radius : inherit ;
35
+ pointer-events : none ;
36
+ }
37
+
38
+ & .md-primary ::after {
39
+ background-color : md-color ($md-primary , 0.12 );
40
+ }
41
+
42
+ & .md-accent ::after {
43
+ background-color : md-color ($md-accent , 0.12 );
44
+ }
45
+
46
+ & .md-warn ::after {
47
+ background-color : md-color ($md-warn , 0.12 );
48
+ }
49
+ }
Original file line number Diff line number Diff line change 7
7
[md-button ] {
8
8
@extend %md-button-base ;
9
9
10
- & :hover , & .md-button-focus {
11
- background-color : md-color ($md-foreground , base , 0.12 );
12
- @include md-button-theme (' background-color' , 0.12 );
13
- }
14
-
15
10
& [disabled ]:hover {
16
11
& .md-primary , & .md-accent , & .md-warn , & :hover {
17
12
background-color : transparent ;
43
38
line-height : $md-icon-button-line-height ;
44
39
border-radius : $md-icon-button-border-radius ;
45
40
46
- & .md-button-focus {
47
- background-color : md-color ($md-foreground , base , 0.12 );
48
- @include md-button-theme (' background-color' , 0.12 );
49
- }
50
-
51
41
.md-button-wrapper > * {
52
42
vertical-align : middle ;
53
43
}
54
44
}
55
45
46
+ // Only flat buttons and icon buttons (not raised or fabs) have a hover style.
47
+ [md-button ]:hover , [md-icon-button ]:hover {
48
+ // Use the same visual treatment for hover as for focus.
49
+ @include md-button-focus ();
50
+ }
51
+
56
52
// Applies a clearer border for high-contrast mode (a11y)
57
53
@media screen and (-ms-high-contrast : active ) {
58
54
.md-raised-button , .md-fab , .md-mini-fab {
59
55
border : 1px solid #fff ;
60
56
}
61
- }
57
+ }
You can’t perform that action at this time.
0 commit comments