Commit c0717e70a0bf23708dbf084f690bb13b60634231

Authored by Vladyslav_Prykhodko
Committed by Andrew Shvayka
1 parent 910d90b9

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

@@ -15,6 +15,6 @@ @@ -15,6 +15,6 @@
15 limitations under the License. 15 limitations under the License.
16 16
17 --> 17 -->
18 -<button mat-icon-button (click)="togglePassword($event)" [attr.aria-pressed]="showPassword" *ngIf="!hideToggle"> 18 +<button mat-icon-button type="button" (click)="togglePassword($event)" [attr.aria-pressed]="showPassword" *ngIf="!hideToggle">
19 <mat-icon>{{ showPassword ? 'visibility' : 'visibility_off' }}</mat-icon> 19 <mat-icon>{{ showPassword ? 'visibility' : 'visibility_off' }}</mat-icon>
20 </button> 20 </button>
@@ -24,13 +24,13 @@ import { AfterViewInit, Component, ElementRef } from '@angular/core'; @@ -24,13 +24,13 @@ import { AfterViewInit, Component, ElementRef } from '@angular/core';
24 export class TogglePasswordComponent implements AfterViewInit { 24 export class TogglePasswordComponent implements AfterViewInit {
25 showPassword = false; 25 showPassword = false;
26 hideToggle = false; 26 hideToggle = false;
  27 +
27 private input: HTMLInputElement = null; 28 private input: HTMLInputElement = null;
28 29
29 constructor(private hostElement: ElementRef) { } 30 constructor(private hostElement: ElementRef) { }
30 31
31 togglePassword($event: Event) { 32 togglePassword($event: Event) {
32 $event.stopPropagation(); 33 $event.stopPropagation();
33 - $event.preventDefault();  
34 this.showPassword = !this.showPassword; 34 this.showPassword = !this.showPassword;
35 this.input.type = this.showPassword ? 'text' : 'password'; 35 this.input.type = this.showPassword ? 'text' : 'password';
36 } 36 }