From 798ec5e21a1a79fdc9b711a340102b371f91e87b Mon Sep 17 00:00:00 2001 From: nikolay Date: Wed, 21 Jun 2023 10:27:05 +0400 Subject: [PATCH] =?UTF-8?q?dev=20#14384=20=D0=9F=D1=80=D0=B0=D0=B2=D0=BA?= =?UTF-8?q?=D0=B0=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BE=D0=BA=20=D0=BE=D1=82?= =?UTF-8?q?=D0=BE=D0=B1=D1=80=D0=B0=D0=B6=D0=B5=D0=BD=D0=B8=D1=8F=20WPA=20?= =?UTF-8?q?=D0=9A=D0=BE=D1=84=D0=B5=D0=9B=D0=B0=D0=B9=D0=BA:=20change=20ke?= =?UTF-8?q?ydown=20to=20input=20on=20code=20enter=20listener?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../default-option/pages/login/login.component.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/angular/src/app/presentation-options/default-option/pages/login/login.component.ts b/angular/src/app/presentation-options/default-option/pages/login/login.component.ts index 0895123..22b5087 100644 --- a/angular/src/app/presentation-options/default-option/pages/login/login.component.ts +++ b/angular/src/app/presentation-options/default-option/pages/login/login.component.ts @@ -53,14 +53,14 @@ export class LoginComponent implements OnInit, AfterViewInit { @ViewChild('field2', { static: false }) field2!: ElementRef; @ViewChild('field3', { static: false }) field3!: ElementRef; - @HostListener('window:keydown', ['$event']) + @HostListener('window:input', ['$event']) HandlKeyEvents(event: any) { - if (!event.target.classList.contains('field')) return; - const key = event.key.toLocaleLowerCase(); + if (!event.target.classList.contains('field')) return; + const key = event.data let elementId = ''; switch (key) { - case 'backspace': + case null: elementId = event.target.id; event.target.value = ''; const prevInputIndex = this.inputIds.indexOf(elementId) - 1; @@ -93,15 +93,19 @@ export class LoginComponent implements OnInit, AfterViewInit { switch (i) { case 0: this.field.nativeElement.focus(); + this.field.nativeElement.click(); break; case 1: this.field1.nativeElement.focus(); + this.field1.nativeElement.click(); break; case 2: this.field2.nativeElement.focus(); + this.field2.nativeElement.click(); break; case 3: this.field3.nativeElement.focus(); + this.field3.nativeElement.click(); break; } }, 0); @@ -155,7 +159,7 @@ export class LoginComponent implements OnInit, AfterViewInit { } submitCode() { - const data = this.codeForm.value; + const data = this.codeForm.value; this.jsonrpc .rpc( {