|
4 | 4 | @import '../core/style/layout-common'; |
5 | 5 | @import '../../cdk/a11y/a11y'; |
6 | 6 |
|
7 | | -.mat-button, .mat-icon-button, .mat-stroked-button, .mat-flat-button { |
8 | | - @include mat-button-base; |
9 | | -} |
10 | | - |
11 | 7 | .mat-button, .mat-icon-button { |
12 | 8 | .mat-button-focus-overlay { |
13 | | - |
14 | 9 | opacity: 0; |
15 | 10 | } |
16 | 11 | } |
17 | 12 |
|
18 | 13 | // Only flat and stroked buttons (not raised, FABs or icon buttons) have a hover style. |
19 | 14 | // Use the same visual treatment for hover as for focus. |
20 | | -.mat-button:hover .mat-button-focus-overlay, |
21 | | -.mat-stroked-button:hover .mat-button-focus-overlay { |
22 | | - opacity: 1; |
| 15 | +.mat-button:hover, |
| 16 | +.mat-stroked-button:hover { |
| 17 | + .mat-button-focus-overlay { |
| 18 | + opacity: 0.04; |
| 19 | + } |
23 | 20 | } |
24 | 21 |
|
25 | 22 | // Disable the hover styles on non-hover devices. Since this is more of a progressive |
26 | 23 | // enhancement and not all desktop browsers support this kind of media query, we can't |
27 | 24 | // use something like `@media (hover)`. |
28 | 25 | @media (hover: none) { |
29 | | - .mat-button:hover .mat-button-focus-overlay, |
30 | | - .mat-stroked-button:hover .mat-button-focus-overlay { |
31 | | - opacity: 0; |
| 26 | + .mat-button:hover, |
| 27 | + .mat-stroked-button:hover { |
| 28 | + .mat-button-focus-overlay { |
| 29 | + opacity: 0; |
| 30 | + } |
32 | 31 | } |
33 | 32 | } |
34 | 33 |
|
| 34 | +// Should be placed after the `:hover` styles so the focused |
| 35 | +// styling coming in from `mat-button-base` takes precedence. |
| 36 | +.mat-button, .mat-icon-button, .mat-stroked-button, .mat-flat-button { |
| 37 | + @include mat-button-base; |
| 38 | +} |
| 39 | + |
35 | 40 | .mat-raised-button { |
36 | 41 | @include mat-raised-button; |
37 | 42 | } |
38 | 43 |
|
39 | 44 | .mat-stroked-button { |
40 | | - border: 1px solid currentColor; |
| 45 | + border: 1px solid currentColor; |
41 | 46 | padding: $mat-stroked-button-padding; |
42 | 47 | line-height: $mat-stroked-button-line-height; |
43 | 48 | } |
|
60 | 65 | height: $mat-icon-button-size; |
61 | 66 |
|
62 | 67 | flex-shrink: 0; |
63 | | - |
64 | 68 | line-height: $mat-icon-button-size; |
65 | 69 | border-radius: $mat-icon-button-border-radius; |
66 | 70 |
|
|
87 | 91 |
|
88 | 92 | // Element that overlays the button to show focus and hover effects. |
89 | 93 | .mat-button-focus-overlay { |
90 | | - // The button spec calls for focus on raised buttons (and FABs) to be indicated with a |
91 | | - // black, 12% opacity shade over the normal color (for both light and dark themes). |
92 | | - background-color: rgba(black, 0.12); |
93 | 94 | border-radius: inherit; |
94 | 95 | opacity: 0; |
95 | 96 |
|
|
0 commit comments