in email step, auto-focus on first input

This commit is contained in:
Ben Wheeler 2019-08-26 16:02:07 -04:00
parent ea9d62129a
commit 19a15988b2

View file

@ -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}
/>
<div className="join-flow-email-checkbox-row">
<FormikCheckbox