From e13dd1dfefc1ae149c0982facf0c1a5276ca5695 Mon Sep 17 00:00:00 2001 From: Andreas Coroiu Date: Mon, 8 May 2023 08:25:14 +0200 Subject: [PATCH] feat: tweak error onBlur/touched/untouched behavior (#5292) --- libs/components/src/input/input.directive.ts | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/libs/components/src/input/input.directive.ts b/libs/components/src/input/input.directive.ts index 2c4cb61eb2..60589208d5 100644 --- a/libs/components/src/input/input.directive.ts +++ b/libs/components/src/input/input.directive.ts @@ -78,15 +78,9 @@ export class BitInputDirective implements BitFormFieldControl { return this.id; } - private isActive = true; - @HostListener("blur") - onBlur() { - this.isActive = true; - } - @HostListener("input") onInput() { - this.isActive = false; + this.ngControl?.control?.markAsUntouched(); } get hasError() { @@ -97,7 +91,7 @@ export class BitInputDirective implements BitFormFieldControl { this.ngControl?.errors != null ); } else { - return this.ngControl?.status === "INVALID" && this.ngControl?.touched && this.isActive; + return this.ngControl?.status === "INVALID" && this.ngControl?.touched; } }