mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2025-02-17 00:21:20 -05:00
in email step, auto-focus on first input
This commit is contained in:
parent
ea9d62129a
commit
19a15988b2
1 changed files with 9 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue