Open makepanic opened 6 years ago
Hi @makepanic, that would mean that focussing and un-focussing an input element without changing it wouldn't mark it dirty, right? I think that's not great for UX - for example, you wouldn't immediately see required field validations anymore.
I guess you're right that it doesn't make sense for all forms.
For our case we have a form that takes focus and only validates when changing the value or once it's submitted. Required fields are visually marked and simply focus/blur isn't triggering the validation.
I guess we can close this issue as it's possible to create a validated-input
component and simply overwrite the default setDirty
implementation to use model.isDirty
.
Alright - i'll leave the issue open for a bit anyway. If there's more demand for something like this we could consider adding an option.
Right now setDirty always sets the
dirty
property totrue
. We could make it more clever to onlydirty
the form if the changesetisDirty
istrue
.This also helps to prevents validating the form when removing focus of a form that uses
autofocus
to focus the first input element.If you're fine with this solution, I could open a PR.