Ability to disable default blur handler
See original GitHub issueSummary 💡
Not all use cases may wish to have the Formik onBlur
function called to touch fields when blurring. Ideally there would be a way to disable this behaviour (see motiviation section). I do not know whether it would be possible for users to disable this globally, or whether it might just need to respect the Formik validateOnBlur
maybe, or another option all together?
Obviously this can be disabled “manually” by passing a custom no-op onBlur
function; however, this would require passing a no-op to every textfield (or general MUI form component) or wrapping in a custom component (not awful, but not ideal).
Motivation 🔦
While common, calling the blur function automatically results in fields being “touched” on blur, while some people may wish to only have them touched on submit. For example, it may be desired to not see errors until after the initial submit, which is not possible currently (as fields are touched on blur).
Issue Analytics
- State:
- Created a year ago
- Comments:6
Top GitHub Comments
I actually use a mixture of both. I have several projects using it and some of the more complicated components (Autocomplete) is really tricky to do right. But yes the core goal is to get people going quickly
I have managed to avoid this so far but I thought we might eventually need it.
We could create a Context that allows users to customize beaviour
Then users can customize behaviour globaly or per form or component
(Select is probably an oversight)