Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Input Field Validation is Delayed #2116

Closed
JDavidStevens opened this issue Apr 5, 2023 · 2 comments · Fixed by #2119
Closed

Input Field Validation is Delayed #2116

JDavidStevens opened this issue Apr 5, 2023 · 2 comments · Fixed by #2119
Labels

Comments

@JDavidStevens
Copy link
Contributor

Summary

If a required field is left blank or invalid information is added into an input field, tabbing or clicking out of the input box does not trigger the validation error message immediately.

Reproduction

Steps to reproduce:

This can be tested using the Cashmere Input-Required example

  1. Tab into or click inside the required input field.
  2. Leave the field blank
  3. Tab out of the field or click outside of it with your mouse

The validation message does not appear at that point. It requires clicking back into the input field and then clicking out of it again, or multiple mouse clicks outside of the field before the validation message activates.

Additional Info
From Andrew Frueh:
"In older versions of Cashmere, there was a constant DoCheck loop that would check for changes to error state. Now it only listens for changes to the valid status or form submit"
See input.directive.ts
"and then also if you look at line 217 there, you’ll see that the control needs to be touched before the control will throw an error...
unfortunately there isn’t a way to listen for changes to the touched state - so on line 129 you’ll see that onBlur there is a call to check the error state again"

@andrew-frueh
Copy link
Collaborator

Fascinating! This is one where Chrome and Firefox behave differently. I do all my dev on Firefox which is why I missed this one. This bug actually doesn't appear in Firefox, but I can reproduce as you described in Chrome. Working on a fix now.

andrew-frueh added a commit to andrew-frueh/Fabric.Cashmere that referenced this issue Apr 10, 2023
force an input element to mark its ngControl as touched on blur

closes HealthCatalyst#2116
@health-catalyst
Copy link
Contributor

🎉 This issue has been resolved in version 14.3.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants