Skip to content

Commit

Permalink
Fixed cases where ripple is triggered when not properly destroyed
Browse files Browse the repository at this point in the history
  • Loading branch information
cagataycivici committed Sep 15, 2022
1 parent 8c9acaa commit 9f639b9
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/app/components/ripple/ripple.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export class Ripple implements AfterViewInit, OnDestroy {

mouseDownListener: any;

timeout: any;

ngAfterViewInit() {
if (this.config && this.config.ripple) {
this.zone.runOutsideAngular(() => {
Expand Down Expand Up @@ -48,6 +50,13 @@ export class Ripple implements AfterViewInit, OnDestroy {
ink.style.top = y + 'px';
ink.style.left = x + 'px';
DomHandler.addClass(ink, 'p-ink-active');

this.timeout = setTimeout(() => {
let ink = this.getInk();
if (ink) {
DomHandler.removeClass(ink, 'p-ink-active');
}
}, 401);
}

getInk() {
Expand All @@ -66,7 +75,10 @@ export class Ripple implements AfterViewInit, OnDestroy {
}
}

onAnimationEnd(event) {
onAnimationEnd(event: Event) {
if (this.timeout) {
clearTimeout(this.timeout);
}
DomHandler.removeClass(event.currentTarget, 'p-ink-active');
}

Expand Down

1 comment on commit 9f639b9

@cetincakiroglu
Copy link
Contributor

Choose a reason for hiding this comment

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

Fixes #11933

Please sign in to comment.