Browse Source

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

pull/5049/head
Vladyslav_Prykhodko 5 years ago
committed by Andrew Shvayka
parent
commit
c0717e70a0
  1. 2
      ui-ngx/src/app/shared/components/button/toggle-password.component.html
  2. 2
      ui-ngx/src/app/shared/components/button/toggle-password.component.ts

2
ui-ngx/src/app/shared/components/button/toggle-password.component.html

@ -15,6 +15,6 @@
limitations under the License. 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> <mat-icon>{{ showPassword ? 'visibility' : 'visibility_off' }}</mat-icon>
</button> </button>

2
ui-ngx/src/app/shared/components/button/toggle-password.component.ts

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

Loading…
Cancel
Save