UI: Fixed focus in toggle-password button after push enter button

This commit is contained in:
Vladyslav_Prykhodko 2021-08-06 14:42:15 +03:00 committed by Andrew Shvayka
parent 910d90b9e5
commit c0717e70a0
2 changed files with 2 additions and 2 deletions

View File

@ -15,6 +15,6 @@
limitations under the License.
-->
<button mat-icon-button (click)="togglePassword($event)" [attr.aria-pressed]="showPassword" *ngIf="!hideToggle">
<button mat-icon-button type="button" (click)="togglePassword($event)" [attr.aria-pressed]="showPassword" *ngIf="!hideToggle">
<mat-icon>{{ showPassword ? 'visibility' : 'visibility_off' }}</mat-icon>
</button>

View File

@ -24,13 +24,13 @@ import { AfterViewInit, Component, ElementRef } from '@angular/core';
export class TogglePasswordComponent implements AfterViewInit {
showPassword = false;
hideToggle = false;
private input: HTMLInputElement = null;
constructor(private hostElement: ElementRef) { }
togglePassword($event: Event) {
$event.stopPropagation();
$event.preventDefault();
this.showPassword = !this.showPassword;
this.input.type = this.showPassword ? 'text' : 'password';
}