diff --git a/libs/angular/src/auth/components/user-verification.component.ts b/libs/angular/src/auth/components/user-verification.component.ts index d8b46810a0b..14a3a3a7759 100644 --- a/libs/angular/src/auth/components/user-verification.component.ts +++ b/libs/angular/src/auth/components/user-verification.component.ts @@ -27,6 +27,9 @@ export class UserVerificationComponent implements ControlValueAccessor, OnInit { set invalidSecret(value: boolean) { this._invalidSecret = value; this.invalidSecretChange.emit(value); + if (value) { + this.secret.markAsTouched(); + } this.secret.updateValueAndValidity({ emitEvent: false }); } @Output() invalidSecretChange = new EventEmitter(); diff --git a/libs/components/src/input/input.directive.ts b/libs/components/src/input/input.directive.ts index 60589208d52..2c4cb61eb2b 100644 --- a/libs/components/src/input/input.directive.ts +++ b/libs/components/src/input/input.directive.ts @@ -78,9 +78,15 @@ export class BitInputDirective implements BitFormFieldControl { return this.id; } + private isActive = true; + @HostListener("blur") + onBlur() { + this.isActive = true; + } + @HostListener("input") onInput() { - this.ngControl?.control?.markAsUntouched(); + this.isActive = false; } get hasError() { @@ -91,7 +97,7 @@ export class BitInputDirective implements BitFormFieldControl { this.ngControl?.errors != null ); } else { - return this.ngControl?.status === "INVALID" && this.ngControl?.touched; + return this.ngControl?.status === "INVALID" && this.ngControl?.touched && this.isActive; } }