Skip to content

Commit

Permalink
docs(material/form-field): disable bubbling on prefix in example (#29069
Browse files Browse the repository at this point in the history
)

* form field button click event bubbling fix

* mousevent change
  • Loading branch information
maruthumj authored May 20, 2024
1 parent 8f54edf commit c0841f1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<mat-form-field>
<mat-label>Enter your password</mat-label>
<input matInput [type]="hide ? 'password' : 'text'">
<button mat-icon-button matSuffix (click)="hide = !hide" [attr.aria-label]="'Hide password'" [attr.aria-pressed]="hide">
<button mat-icon-button matSuffix (click)="clickEvent($event)" [attr.aria-label]="'Hide password'" [attr.aria-pressed]="hide">
<mat-icon>{{hide ? 'visibility_off' : 'visibility'}}</mat-icon>
</button>
</mat-form-field>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,8 @@ import {MatFormFieldModule} from '@angular/material/form-field';
})
export class FormFieldPrefixSuffixExample {
hide = true;
clickEvent(event: MouseEvent) {
this.hide = !this.hide;
event.stopPropagation();
}
}

0 comments on commit c0841f1

Please sign in to comment.