1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-21 11:35:34 +01: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;
}
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;
}
}