Fix event propagation on disabled circle button
This commit is contained in:
parent
c91f923bfa
commit
f98109ca45
@ -1,15 +1,20 @@
|
||||
<div [matTooltipClass]="tooltipClass" [matTooltipPosition]="tooltipPosition" [matTooltip]="tooltip">
|
||||
<div
|
||||
(click)="preventActionOnDisabled($event)"
|
||||
[matTooltipClass]="tooltipClass"
|
||||
[matTooltipPosition]="tooltipPosition"
|
||||
[matTooltip]="tooltip"
|
||||
>
|
||||
<button
|
||||
(click)="performAction($event)"
|
||||
[class.dark-bg]="type === circleButtonTypes.dark"
|
||||
[class.grey-selected]="greySelected"
|
||||
[class.help]="type === circleButtonTypes.help"
|
||||
[class.overlay]="showDot"
|
||||
[class.primary]="type === circleButtonTypes.primary"
|
||||
[class.warn]="type === circleButtonTypes.warn"
|
||||
[class.help]="type === circleButtonTypes.help"
|
||||
[class.grey-selected]="greySelected"
|
||||
[disabled]="disabled"
|
||||
[type]="isSubmit ? 'submit' : 'button'"
|
||||
[id]="id ? id : buttonId"
|
||||
[type]="isSubmit ? 'submit' : 'button'"
|
||||
mat-icon-button
|
||||
>
|
||||
<mat-icon [svgIcon]="icon"></mat-icon>
|
||||
|
||||
@ -42,10 +42,6 @@ export class CircleButtonComponent implements OnInit {
|
||||
}
|
||||
|
||||
performAction($event: MouseEvent): void {
|
||||
if (this.disabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.removeTooltip) {
|
||||
this._matTooltip.hide();
|
||||
// Timeout to allow tooltip to disappear first,
|
||||
@ -55,4 +51,10 @@ export class CircleButtonComponent implements OnInit {
|
||||
this.action.emit($event);
|
||||
}
|
||||
}
|
||||
|
||||
preventActionOnDisabled($event: MouseEvent): void {
|
||||
if (this.disabled) {
|
||||
$event.stopPropagation();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user