UI: Fixed focus in toggle-password button after push enter button
This commit is contained in:
parent
910d90b9e5
commit
c0717e70a0
@ -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>
|
||||||
|
|||||||
@ -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…
x
Reference in New Issue
Block a user