when select dropdown is focused, clear any validation errors

This commit is contained in:
Ben Wheeler 2019-09-16 22:34:32 -04:00
parent 303481b61d
commit 628e00f401
2 changed files with 13 additions and 2 deletions

View file

@ -84,7 +84,8 @@ class BirthDateStep extends React.Component {
const {
errors,
handleSubmit,
isSubmitting
isSubmitting,
setFieldError
} = props;
return (
<JoinFlowStep
@ -118,6 +119,9 @@ class BirthDateStep extends React.Component {
'validation-birthdate-month',
'validation-left'
)}
/* eslint-disable react/jsx-no-bind */
onFocus={() => setFieldError('birth_month', null)}
/* eslint-enable react/jsx-no-bind */
/>
<FormikSelect
className={classNames(
@ -131,6 +135,9 @@ class BirthDateStep extends React.Component {
options={birthYearOptions}
validate={this.validateSelect}
validationClassName="validation-birthdate-year"
/* eslint-disable react/jsx-no-bind */
onFocus={() => setFieldError('birth_year', null)}
/* eslint-enable react/jsx-no-bind */
/>
</div>
<div className="join-flow-privacy-message">

View file

@ -64,7 +64,8 @@ class CountryStep extends React.Component {
const {
errors,
handleSubmit,
isSubmitting
isSubmitting,
setFieldError
} = props;
return (
<JoinFlowStep
@ -93,6 +94,9 @@ class CountryStep extends React.Component {
options={this.countryOptions}
validate={this.validateSelect}
validationClassName="validation-full-width-input"
/* eslint-disable react/jsx-no-bind */
onFocus={() => setFieldError('country', null)}
/* eslint-enable react/jsx-no-bind */
/>
{/* note that this is a hidden checkbox the user will never see */}
<FormikCheckbox