From a5a7b38da9f300e8199247cc9c4b93406817ad88 Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Mon, 9 Nov 2020 16:33:25 +1100 Subject: [PATCH] add autoFocus feature to SessionInput --- ts/components/session/RegistrationTabs.tsx | 8 +++++--- ts/components/session/SessionInput.tsx | 4 ++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ts/components/session/RegistrationTabs.tsx b/ts/components/session/RegistrationTabs.tsx index bc8c9aa88..657c3deac 100644 --- a/ts/components/session/RegistrationTabs.tsx +++ b/ts/components/session/RegistrationTabs.tsx @@ -404,6 +404,7 @@ export class RegistrationTabs extends React.Component<{}, State> { { @@ -413,7 +414,7 @@ export class RegistrationTabs extends React.Component<{}, State> { this.handlePressEnter(); }} /> - {this.renderNamePasswordAndVerifyPasswordFields()} + {this.renderNamePasswordAndVerifyPasswordFields(false)} ); } @@ -467,7 +468,7 @@ export class RegistrationTabs extends React.Component<{}, State> { if (signUpMode === SignUpMode.EnterDetails) { return (
- {this.renderNamePasswordAndVerifyPasswordFields()} + {this.renderNamePasswordAndVerifyPasswordFields(true)}
); } @@ -475,7 +476,7 @@ export class RegistrationTabs extends React.Component<{}, State> { return null; } - private renderNamePasswordAndVerifyPasswordFields() { + private renderNamePasswordAndVerifyPasswordFields(stealAutoFocus: boolean = false) { const { password, passwordFieldsMatch } = this.state; const passwordsDoNotMatch = !passwordFieldsMatch && this.state.password @@ -485,6 +486,7 @@ export class RegistrationTabs extends React.Component<{}, State> { return (
{ public render() { const { + autoFocus, placeholder, type, value, @@ -55,6 +58,7 @@ export class SessionInput extends React.PureComponent { placeholder={placeholder} value={value} maxLength={maxLength} + autoFocus={autoFocus} onChange={e => { this.updateInputValue(e); }}