Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Ripple rewrite #4166

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
11 changes: 0 additions & 11 deletions src/components/button/button-theme.scss
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
$button-border-radius: 3px !default;
$button-fab-border-radius: 50% !default;
$button-icon-border-radius: $button-fab-border-radius;

a.md-button.md-THEME_NAME-theme,
.md-button.md-THEME_NAME-theme {
border-radius: $button-border-radius;

&:not([disabled]) {
&:hover {
Expand All @@ -19,7 +14,6 @@ a.md-button.md-THEME_NAME-theme,
}

&.md-fab {
border-radius: $button-fab-border-radius;
background-color: '{{accent-color}}';
color: '{{accent-contrast}}';
md-icon {
Expand All @@ -35,10 +29,6 @@ a.md-button.md-THEME_NAME-theme,
}
}

&.md-icon-button {
border-radius: $button-icon-border-radius;
}

&.md-primary {
color: '{{primary-color}}';
&.md-raised,
Expand All @@ -64,7 +54,6 @@ a.md-button.md-THEME_NAME-theme,
}
}
&.md-fab {
border-radius: $button-fab-border-radius;
background-color: '{{accent-color}}';
color: '{{accent-contrast}}';
&:not([disabled]) {
Expand Down
21 changes: 17 additions & 4 deletions src/components/button/button.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
$button-border-radius: 3px !default;
$button-fab-border-radius: 50% !default;
$button-icon-border-radius: $button-fab-border-radius;

$button-line-height: rem(3.60) !default;
$button-padding: 0 rem(0.600) !default;
$button-margin: rem(0.600) rem(0.800) !default;
Expand All @@ -16,6 +20,7 @@ $icon-button-width: rem(4.800) !default;
$icon-button-margin: rem(0.600) !default;

.md-button {
border-radius: $button-border-radius;
box-sizing: border-box;
color: currentColor;

Expand Down Expand Up @@ -92,9 +97,9 @@ $icon-button-margin: rem(0.600) !default;
padding-left: 0;
padding-right: 0;
width: $icon-button-width;
border-radius: 50%;
border-radius: $button-icon-border-radius;
.md-ripple-container {
border-radius: 50%;
border-radius: $button-icon-border-radius;
background-clip: padding-box;
overflow: hidden;
// The following hack causes Safari/Chrome to respect overflow hidden for ripples
Expand All @@ -116,14 +121,14 @@ $icon-button-margin: rem(0.600) !default;
vertical-align: middle;

@include md-shadow-bottom-z-1();
border-radius: 50%;
border-radius: $button-fab-border-radius;
background-clip: padding-box;
overflow: hidden;

transition: 0.2s linear;
transition-property: background-color, box-shadow;
.md-ripple-container {
border-radius: 50%;
border-radius: $button-fab-border-radius;
background-clip: padding-box;
overflow: hidden;
// The following hack causes Safari/Chrome to respect overflow hidden for ripples
Expand All @@ -149,6 +154,14 @@ $icon-button-margin: rem(0.600) !default;
}
}
}

.md-ripple-container {
border-radius: $button-border-radius;
background-clip: padding-box;
overflow: hidden;
// The following hack causes Safari/Chrome to respect overflow hidden for ripples
-webkit-mask-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAA5JREFUeNpiYGBgAAgwAAAEAAGbA+oJAAAAAElFTkSuQmCC');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any chance we have a link to an article of why this works? Would be nice to add to the comment if available.

}
}

.md-toast-open-top {
Expand Down
2 changes: 1 addition & 1 deletion src/components/button/button.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('md-button', function() {
var button = $compile('<md-button md-ink-ripple="#f00">button</md-button>')($rootScope);

button.triggerHandler({ type: '$md.pressdown', pointer: { x: 0, y: 0 } });
expect(button[0].getElementsByClassName('md-ripple-container').length).toBe(1);
expect(button[0].getElementsByClassName('md-ripple-container').length).toBe(0);
}));


Expand Down
Loading