mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-27 01:25:52 -05:00
gender step gets custom input ref, focuses on click
This commit is contained in:
parent
5ec8811427
commit
2aa5ea0f02
1 changed files with 9 additions and 1 deletions
|
@ -55,9 +55,13 @@ class GenderStep extends React.Component {
|
|||
constructor (props) {
|
||||
super(props);
|
||||
bindAll(this, [
|
||||
'handleSetCustomRef',
|
||||
'handleValidSubmit'
|
||||
]);
|
||||
}
|
||||
handleSetCustomRef (customInputRef) {
|
||||
this.customInput = customInputRef;
|
||||
}
|
||||
handleValidSubmit (formData, formikBag) {
|
||||
formikBag.setSubmitting(false);
|
||||
if (!formData.gender || formData.gender === 'null') {
|
||||
|
@ -122,7 +126,10 @@ class GenderStep extends React.Component {
|
|||
{'gender-radio-row-selected': (values.gender === values.custom)}
|
||||
)}
|
||||
/* eslint-disable react/jsx-no-bind */
|
||||
onClick={() => setFieldValue('gender', values.custom, false)}
|
||||
onClick={() => {
|
||||
setFieldValue('gender', values.custom, false);
|
||||
if (this.customInput) this.customInput.focus();
|
||||
}}
|
||||
/* eslint-enable react/jsx-no-bind */
|
||||
>
|
||||
<FormikRadioButton
|
||||
|
@ -139,6 +146,7 @@ class GenderStep extends React.Component {
|
|||
gender: newCustomVal,
|
||||
custom: newCustomVal
|
||||
})}
|
||||
onSetCustomRef={this.handleSetCustomRef}
|
||||
/* eslint-enable react/jsx-no-bind */
|
||||
/>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue