|
5 | 5 | @import '../../cdk/a11y/a11y'; |
6 | 6 |
|
7 | 7 | .mat-button, .mat-icon-button { |
8 | | - .mat-button-focus-overlay { |
| 8 | + &::before { |
9 | 9 | opacity: 0; |
10 | 10 | } |
11 | 11 | } |
|
14 | 14 | // Use the same visual treatment for hover as for focus. |
15 | 15 | .mat-button:hover, |
16 | 16 | .mat-stroked-button:hover { |
17 | | - .mat-button-focus-overlay { |
| 17 | + &::before { |
18 | 18 | opacity: 0.04; |
19 | 19 | } |
20 | 20 | } |
|
25 | 25 | @media (hover: none) { |
26 | 26 | .mat-button:hover, |
27 | 27 | .mat-stroked-button:hover { |
28 | | - .mat-button-focus-overlay { |
| 28 | + &::before { |
29 | 29 | opacity: 0; |
30 | 30 | } |
31 | 31 | } |
|
41 | 41 | @include mat-raised-button; |
42 | 42 | } |
43 | 43 |
|
44 | | -.mat-stroked-button { |
45 | | - border: $mat-stroked-button-border-width solid currentColor; |
46 | | - padding: $mat-stroked-button-padding; |
47 | | - line-height: $mat-stroked-button-line-height; |
48 | | - |
49 | | - // Since the stroked button has has an actual border that reduces the available space for |
50 | | - // child elements such as the ripple container or focus overlay, an inherited border radius |
51 | | - // for the absolute-positioned child elements does not work properly. This is because the |
52 | | - // child element cannot expand to the same boundaries as the parent element with a border. |
53 | | - // In order to work around this issue by *not* hiding overflow, we adjust the child elements |
54 | | - // to fully cover the actual button element. This means that the border-radius would be correct |
55 | | - // then. See: https://github.com/angular/components/issues/13738 |
56 | | - .mat-button-ripple.mat-ripple, .mat-button-focus-overlay { |
57 | | - top: -$mat-stroked-button-border-width; |
58 | | - left: -$mat-stroked-button-border-width; |
59 | | - right: -$mat-stroked-button-border-width; |
60 | | - bottom: -$mat-stroked-button-border-width; |
61 | | - } |
62 | | -} |
63 | | - |
64 | 44 | .mat-fab { |
65 | 45 | @include mat-fab($mat-fab-size, $mat-fab-padding); |
66 | 46 | } |
|
91 | 71 | // Increase specificity for the ripple container because ripple styles are part of |
92 | 72 | // the `mat-core` mixin and can potentially overwrite the absolute position of the container. |
93 | 73 | .mat-button-ripple.mat-ripple, |
94 | | -.mat-button-focus-overlay { |
| 74 | +.mat-button-base::before { |
95 | 75 | @include mat-fill; |
96 | 76 |
|
97 | 77 | // Disable pointer events for the ripple container and focus overlay because the container |
|
112 | 92 | transform: translateZ(0); |
113 | 93 | } |
114 | 94 |
|
| 95 | +.mat-button-wrapper { |
| 96 | + // Bump the `z-index` so the focus overlay and ripples go behind the content. |
| 97 | + z-index: 1; |
| 98 | + position: relative; |
| 99 | +} |
| 100 | + |
115 | 101 | // Element that overlays the button to show focus and hover effects. |
116 | | -.mat-button-focus-overlay { |
| 102 | +.mat-button-base::before { |
117 | 103 | opacity: 0; |
118 | 104 | transition: $mat-button-focus-transition; |
| 105 | + content: ''; |
119 | 106 |
|
120 | 107 | ._mat-animation-noopable & { |
121 | 108 | transition: none; |
|
144 | 131 | z-index: 1; |
145 | 132 | } |
146 | 133 |
|
| 134 | +// Note that this needs to be after initial declarations for `.mat-button-ripple` and |
| 135 | +// `.mat-button-base::before` so that we can override the top/left/right/bottom without |
| 136 | +// having to bump the specificity. |
| 137 | +.mat-stroked-button { |
| 138 | + border: $mat-stroked-button-border-width solid currentColor; |
| 139 | + padding: $mat-stroked-button-padding; |
| 140 | + line-height: $mat-stroked-button-line-height; |
| 141 | + |
| 142 | + // Since the stroked button has has an actual border that reduces the available space for |
| 143 | + // child elements such as the ripple container or focus overlay, an inherited border radius |
| 144 | + // for the absolute-positioned child elements does not work properly. This is because the |
| 145 | + // child element cannot expand to the same boundaries as the parent element with a border. |
| 146 | + // In order to work around this issue by *not* hiding overflow, we adjust the child elements |
| 147 | + // to fully cover the actual button element. This means that the border-radius would be correct |
| 148 | + // then. See: https://github.com/angular/components/issues/13738 |
| 149 | + .mat-button-ripple.mat-ripple, &::before { |
| 150 | + top: -$mat-stroked-button-border-width; |
| 151 | + left: -$mat-stroked-button-border-width; |
| 152 | + right: -$mat-stroked-button-border-width; |
| 153 | + bottom: -$mat-stroked-button-border-width; |
| 154 | + } |
| 155 | +} |
| 156 | + |
147 | 157 | // Elements inside of all type of buttons should be vertical aligned in the middle. |
148 | 158 | .mat-button, .mat-flat-button, .mat-stroked-button, .mat-raised-button, .mat-icon-button, |
149 | 159 | .mat-fab, .mat-mini-fab { |
|
0 commit comments