mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 08:43:33 +00:00
[PM-2135] feat: hack mark as touched to get error to display
This commit is contained in:
@@ -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<boolean>();
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user