1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-06-28 10:55:27 +02:00

feat: tweak error onBlur/touched/untouched behavior (#5292)

This commit is contained in:
Andreas Coroiu 2023-05-08 08:25:14 +02:00 committed by GitHub
parent a9ab32b476
commit e13dd1dfef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -78,15 +78,9 @@ export class BitInputDirective implements BitFormFieldControl {
return this.id; return this.id;
} }
private isActive = true;
@HostListener("blur")
onBlur() {
this.isActive = true;
}
@HostListener("input") @HostListener("input")
onInput() { onInput() {
this.isActive = false; this.ngControl?.control?.markAsUntouched();
} }
get hasError() { get hasError() {
@ -97,7 +91,7 @@ export class BitInputDirective implements BitFormFieldControl {
this.ngControl?.errors != null this.ngControl?.errors != null
); );
} else { } else {
return this.ngControl?.status === "INVALID" && this.ngControl?.touched && this.isActive; return this.ngControl?.status === "INVALID" && this.ngControl?.touched;
} }
} }