diff --git a/src/components/formik-forms/formik-input.jsx b/src/components/formik-forms/formik-input.jsx index 6b37790eb..1a5961274 100644 --- a/src/components/formik-forms/formik-input.jsx +++ b/src/components/formik-forms/formik-input.jsx @@ -11,7 +11,7 @@ require('./formik-input.scss'); const FormikInput = ({ className, error, - setRef, + onSetRef, toolTip, validationClassName, wrapperClassName, @@ -32,7 +32,7 @@ const FormikInput = ({ className )} /* formik uses "innerRef" to return the actual input element */ - innerRef={setRef} + innerRef={onSetRef} {...props} /> {error ? ( @@ -54,7 +54,7 @@ const FormikInput = ({ FormikInput.propTypes = { className: PropTypes.string, error: PropTypes.string, - setRef: PropTypes.func, + onSetRef: PropTypes.func, toolTip: PropTypes.string, type: PropTypes.string, validationClassName: PropTypes.string, diff --git a/src/components/formik-forms/formik-radio-button.jsx b/src/components/formik-forms/formik-radio-button.jsx index c09be7139..b7ee7f488 100644 --- a/src/components/formik-forms/formik-radio-button.jsx +++ b/src/components/formik-forms/formik-radio-button.jsx @@ -91,12 +91,12 @@ const FormikRadioButton = ({ onSetCustom(event.target.value)} onFocus={event => onSetCustom(event.target.value)} /* eslint-enable react/jsx-no-bind */ + onSetRef={onSetCustomRef} /> )} diff --git a/src/components/join-flow/email-step.jsx b/src/components/join-flow/email-step.jsx index b9d03e239..98836f1e7 100644 --- a/src/components/join-flow/email-step.jsx +++ b/src/components/join-flow/email-step.jsx @@ -17,11 +17,19 @@ class EmailStep extends React.Component { constructor (props) { super(props); bindAll(this, [ + 'handleSetEmailRef', 'handleValidSubmit', 'validateEmail', 'validateForm' ]); } + componentDidMount () { + // automatically start with focus on username field + if (this.emailInput) this.emailInput.focus(); + } + handleSetEmailRef (emailInputRef) { + this.emailInput = emailInputRef; + } validateEmail (email) { if (!email) return this.props.intl.formatMessage({id: 'general.required'}); const isValidLocally = emailValidator.validate(email); @@ -99,6 +107,7 @@ class EmailStep extends React.Component { onBlur={() => validateField('email')} onFocus={() => setFieldError('email', null)} /* eslint-enable react/jsx-no-bind */ + onSetRef={this.handleSetEmailRef} />
this.handleFocused('username')} /* eslint-enable react/jsx-no-bind */ + onSetRef={this.handleSetUsernameRef} />