Skip to content

fix(stroked-button): ripples and focus overlay have incorrect radius #13745

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions src/lib/button/button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,18 @@
border: 1px solid currentColor;
padding: $mat-stroked-button-padding;
line-height: $mat-stroked-button-line-height;

// Since the stroked button has has an actual border that reduces the available space for
// child elements (such as the ripple container or focus overlay), an inherited border radius
// for absolute positioned child elements which expand to the parent element boundaries, will
// not align with the stroked button border because the child element cannot expand to the same
// boundaries as the parent element with a border.
// See: https://github.com/angular/material2/issues/13738
overflow: hidden;

.mat-button-ripple.mat-ripple, .mat-button-focus-overlay {
border-radius: 0;
}
}

.mat-fab {
Expand Down Expand Up @@ -85,13 +97,15 @@
// Pointer events can be safely disabled because the ripple trigger element is the host element.
pointer-events: none;

// Inherit the border radius from the parent so the ripple is clipped when it reaches the edges.
// Inherit the border radius from the parent so that focus overlay and ripples don't exceed the
// parent button boundaries. Note that an inherited border radius does not work properly if
// the actual button element does have a border because it causes the inner content to be
// smaller. We have special logic for stroked buttons to handle this scenario.
border-radius: inherit;
}

// Element that overlays the button to show focus and hover effects.
.mat-button-focus-overlay {
border-radius: inherit;
opacity: 0;

transition: $mat-button-focus-transition;
Expand Down