jaredpalmer / formik

Build forms in React, without the tears 😭
https://formik.org
Apache License 2.0
33.98k stars 2.79k forks source link

Formik conflict with RadioGroup and TextField of MUI #3680

Open block2k opened 2 years ago

block2k commented 2 years ago

Bug report

when entering the textfield or touching the textfield, the error message of the radio group is displayed even though the radio group area has not been touched

Current Behavior

Touch the textfield then untouch, formik.errors display both error message of textfield and RadioGroup even though I haven't touched the radiogroup

Expected behavior

Touch the textfield then untouch, display only error message of textfield

Reproducible example

This is example of this bug https://codesandbox.io/s/formik-bug-radiogroup-vs-textfield-0tvzcx

Your environment

Software Version(s)
Formik 2.2.9
React 17.0.2
TypeScript no
Browser Chrome
npm/Yarn npm
Operating System Win 10 Pro
vennilamahalingam commented 1 year ago

Refer : https://codesandbox.io/s/formik-bug-select-vs-textfield-forked-9mfdsy?file=/src/App.js Works alright now.

Any particular reason why you have not included formik.touched for Radio button ? As per other examples from documentation also, I understand that the validation schema runs for all fields and its up to the user to display the error message after making sure formik.touched exists for that particular field element.