Skip to content

Commit

Permalink
fix(material-experimental/mdc-slider): don't disable ripples for noop…
Browse files Browse the repository at this point in the history
… animations (#23084)

Noop animations shouldn't disable ripples completely, but rather make them appear immediately.

(cherry picked from commit f361b6c)
  • Loading branch information
crisbeto authored and wagnermaciel committed Jul 1, 2021
1 parent b1974ee commit 431e2e6
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/material-experimental/mdc-slider/slider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ export class MatSliderVisualThumb implements AfterViewInit, OnDestroy {

/** Handles displaying the hover ripple. */
private _showHoverRipple(): void {
if (!this._slider._noopAnimations && !this._isShowingRipple(this._hoverRippleRef)) {
if (!this._isShowingRipple(this._hoverRippleRef)) {
this._hoverRippleRef = this._showRipple({ enterDuration: 0, exitDuration: 0 });
this._hoverRippleRef?.element.classList.add('mat-mdc-slider-hover-ripple');
}
Expand All @@ -219,7 +219,7 @@ export class MatSliderVisualThumb implements AfterViewInit, OnDestroy {

/** Handles displaying the active ripple. */
private _showActiveRipple(): void {
if (!this._slider._noopAnimations && !this._isShowingRipple(this._activeRippleRef)) {
if (!this._isShowingRipple(this._activeRippleRef)) {
this._activeRippleRef = this._showRipple({ enterDuration: 225, exitDuration: 400 });
this._activeRippleRef?.element.classList.add('mat-mdc-slider-active-ripple');
}
Expand All @@ -235,9 +235,11 @@ export class MatSliderVisualThumb implements AfterViewInit, OnDestroy {
if (this.disableRipple) {
return;
}
return this._ripple.launch(
{animation, centered: true, persistent: true},
);
return this._ripple.launch({
animation: this._slider._noopAnimations ? {enterDuration: 0, exitDuration: 0} : animation,
centered: true,
persistent: true
});
}

/** Gets the hosts native HTML element. */
Expand Down

0 comments on commit 431e2e6

Please sign in to comment.