Skip to content

Commit 8765899

Browse files
robert-j-webbpatrickrodee
authored andcommitted
Added a default style of box-sizing content-box to the ripple target for mdc-button (material-components#5130)
Often users of the web apply box-sizing: border-box; to all of their components. If this is done with a page that has a mdc-button, the ripple hover state will be off by a few pixels. Since this practice is so common and it is a very difficult bug to track down and fix, we can take a preventitve measure and enforce the default style on the ripple target. This prevents the problem from happening and has no effect on users who do not use the universal border-box rule.
1 parent 2c793b4 commit 8765899

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

packages/mdc-button/_mixins.scss

+3
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,9 @@ $mdc-button-ripple-target: ".mdc-button__ripple";
147147
#{$mdc-button-ripple-target} {
148148
@include mdc-feature-targets($feat-structure) {
149149
position: absolute;
150+
// Ripple needs content-box as the box sizing and box-sizing: border-box
151+
// is often set as a default, so we override that here.
152+
box-sizing: content-box;
150153
width: 100%;
151154
height: 100%;
152155
overflow: hidden;

0 commit comments

Comments
 (0)