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

Redesign of text input component validation #131

Open
jameswilddev opened this issue Sep 9, 2022 · 0 comments
Open

Redesign of text input component validation #131

jameswilddev opened this issue Sep 9, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@jameswilddev
Copy link
Owner

jameswilddev commented Sep 9, 2022

When a text input is invalid, it reports a change of undefined to the parent form.

This generally works, but falls down in a number of scenarios.

For example, distinguishing between "the parent form told us to change to something invalid" (e.g. resetting a form with an invalid field) and "we told the parent form we're invalid, it's just echoing that back to us" is impossible. I thought I had a way in that I could use focus/blur events to discard any changes while the input was focused, but that's not a fix - the events don't reliably happen in any particular order, especially on big forms, so sometimes the latter is confused for the former.

We might be able to fix this by instead using an object for an invalid value. That way we could:

  • Distinguish between invalid values generated by the component and the form.
  • Maybe include some additional metadata about the issue?
@jameswilddev jameswilddev added the bug Something isn't working label Sep 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant