If we want to make our forms more accessible by having required attribute set, is there a way for Formik to override the browser tooltip (in Chrome for instance) and show our custom error/validation message?
Currently if you set a field to required the Yup validation does not get run, but rather the browser will notify the user that a field is required before a submission is attempted via tooltip.
For anyone searching this issue, using aria-required="true" is a current workaround.
If a field is required via HTML5 attributes, this notification will be suppressed and Formik errors will take precedence.
handleSubmit function looks like, it's not quite clear what the required params to pass to the formik handler are, if any, or if implementing a custom submit handler this can be skipped altogether. This solution would allow for users to more easily e.preventDefault(); which may suppress the default required handlers.Add a noValidate attribute to your <form /> element.
馃憤馃榾
Most helpful comment
Add a
noValidateattribute to your<form />element.