form icon indicating copy to clipboard operation
form copied to clipboard

Changing 'touched' state to reflect the common notion of 'touched'

Open cpepin opened this issue 5 years ago • 13 comments

@tannerlinsley want to get your thoughts on this. Generally, touched in other frameworks, libraries, etc. represents a field that has been focused/blurred. The touched state in react-form seems to represent dirty, but without the touched state, it's difficult to have a UX that needs to show validation on blur. Currently, with touched representing dirty, validation messaging will immediately populate as soon as a user types one character. For things like email fields this isn't great, as the user likely hasn't finished typing. I understand there is a concept of debounce, but I feel like that is solving something different.

cpepin avatar Nov 03 '19 15:11 cpepin

Agreed. This is good. What if the user wants to actually validate as you type tho?

tannerlinsley avatar Nov 03 '19 15:11 tannerlinsley

Thinking we’ll need to add a “dirty” state. I can add it to this PR, just wanted to make sure you agreed first 👍

cpepin avatar Nov 03 '19 15:11 cpepin

Sounds good to me. Try to keep it all non breaking?

Tanner Linsley On Nov 3, 2019, 8:35 AM -0700, cpepin [email protected], wrote:

Thinking we’ll need to add a “dirty” state. I can add it to this PR, just wanted to make sure you agreed first 👍 — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

tannerlinsley avatar Nov 03 '19 15:11 tannerlinsley

Btw, really dig the approach you took with all of this.

cpepin avatar Nov 03 '19 15:11 cpepin

For sure 👍

cpepin avatar Nov 03 '19 15:11 cpepin

Aww thanks man!

Tanner Linsley On Nov 3, 2019, 8:36 AM -0700, cpepin [email protected], wrote:

Btw, really dig the approach you took with all of this. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

tannerlinsley avatar Nov 03 '19 15:11 tannerlinsley

I just wanted to bump this as it would be incredibly helpful to our team. Thanks all!

tmilewski avatar Dec 10 '19 16:12 tmilewski

@tmilewski Sorry for the delay, I definitely don't mind pitching in. The more I think about it though - I'm not sure we can do this without a breaking change. It fundamentally changes how touched is working.

cpepin avatar Dec 10 '19 19:12 cpepin

@cpepin No worries, I appreciate all the work! I agree. I don't think that there is a way this pans out without a breaking change.

That said, I feel that as long as there's a different way to identify touched it as people have come to expect, doing that and bumping a major version number should be okay.

tmilewski avatar Dec 10 '19 22:12 tmilewski

Tossing in another opinion/bump here - It seems appropriate to bump the major version with this change. I've also struggled with this usage of touched vs dirty where my forms are showing errors earlier than i want them to, but i have no way to defer the showing of errors until a blur occurs

timcosta avatar Dec 22 '19 21:12 timcosta

@tannerlinsley what are your thoughts on a major release for this? I don’t mind contributing the code but I’ve been avoiding jumping on it, as I didn’t want to introduce any breaking changes.

cpepin avatar Dec 23 '19 10:12 cpepin

anything new about this topic? do you have any workaround for this one?

GuySerfaty avatar Apr 05 '20 08:04 GuySerfaty

It's the biggest problem of the lib, dosn't has dirty, because the error is showing earlier... so make the libary useless thinking on UX

hamonCordova avatar May 25 '22 15:05 hamonCordova

Closing this PR for now, as we're working on a substantial rework of the codebase that's expected to undergo more rapid changes as I work on stabilizing things.

Rest assured that we'll have isDirty and isTouched as two distinct items :)

If you'd like to get involved in the rework, join our Discord and reach out in the #form channel

crutchcorn avatar Aug 29 '23 08:08 crutchcorn