Skip to content

fix(button): square ripple in compatibility mode #3167

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 1 commit into from
Feb 21, 2017
Merged
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
2 changes: 1 addition & 1 deletion src/lib/button/button.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<span class="mat-button-wrapper"><ng-content></ng-content></span>
<div md-ripple *ngIf="!_isRippleDisabled()" class="mat-button-ripple"
[class.mat-button-ripple-round]="_isRoundButton()"
[class.mat-button-ripple-round]="_isRoundButton"
[mdRippleTrigger]="_getHostElement()"></div>
<!-- the touchstart handler prevents the overlay from capturing the initial tap on touch devices -->
<div class="mat-button-focus-overlay" (touchstart)="$event.preventDefault()"></div>
13 changes: 6 additions & 7 deletions src/lib/button/button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ export class MdButton {
/** Whether a mousedown has occurred on this element in the last 100ms. */
_isMouseDown: boolean = false;

/** Whether the button is round. */
_isRoundButton: boolean = ['icon-button', 'fab', 'mini-fab'].some(suffix => {
let el = this._getHostElement();
return el.hasAttribute('md-' + suffix) || el.hasAttribute('mat-' + suffix);
});

/** Whether the ripple effect on click should be disabled. */
private _disableRipple: boolean = false;
private _disabled: boolean = null;
Expand Down Expand Up @@ -165,13 +171,6 @@ export class MdButton {
return this._elementRef.nativeElement;
}

_isRoundButton() {
const el = this._getHostElement();
return el.hasAttribute('md-icon-button') ||
el.hasAttribute('md-fab') ||
el.hasAttribute('md-mini-fab');
}

_isRippleDisabled() {
return this.disableRipple || this.disabled;
}
Expand Down