Skip to content

bug(MatRipple): mat-ripple-element is not fired correctly on disable #22520

Closed
@cynthialong0-0

Description

@cynthialong0-0

Working on resolving a bug that MatRipple stuck in the focus state. When on disable, sometimes the ripple cannot fade out the ripple in time. After investigation, it seems that there is opportunity when the mouseup event is not captured before setting to disable and mat-ripple-element is not fired correctly .

Reproduce the error

Live example in stackblitz

Step to reproduce
  1. Immediately click the icon button when move the cursor on it.
  2. Try couple of times if you cannot see the state stuck after you move away the cursor.
  3. Try more times after you reproduce it - you will see the color of the state becomes darker, since multiple mat-ripple-elements are not fired correctly.

image

Expected behavior

mat-ripple-element should be always deleted on mouse up

Environment

Angular Material: 11.2.9
rxjs: 6.6.7
Browser: Chrome
Operating system: Mac

Fix

On disable, it should call fadeOutAll() method to make sure all mat-ripple-elements are fired. So I propose to have this change on the ripple disabled variable:

  set disabled(value: boolean) {
    if (value) {
      this.fadeOutAll();
    }
    this._disabled = value;
    this._setupTriggerEventsIfEnabled();
  }

Metadata

Metadata

Assignees

Labels

GThis is is related to a Google internal issueP4A relatively minor issue that is not relevant to core functionsarea: material/core

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions