Merge pull request #3361 from benjiwheeler/join-flow-dropdown-validation

when select dropdown is focused, clear any validation errors
This commit is contained in:
Benjamin Wheeler 2019-09-23 09:56:19 -04:00 committed by GitHub
commit ecdfaeeeec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 2 deletions

View file

@ -85,7 +85,8 @@ class BirthDateStep extends React.Component {
const {
errors,
handleSubmit,
isSubmitting
isSubmitting,
setFieldError
} = props;
return (
<JoinFlowStep
@ -119,6 +120,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(
@ -132,6 +136,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