From b40b928dc5ea8b4608ad2a89748adb61e7af9250 Mon Sep 17 00:00:00 2001 From: Rajat Parashar Date: Thu, 12 Aug 2021 03:23:18 +0530 Subject: [PATCH 1/2] fix: ExpensiInput autoFocus & tab Focus --- src/components/ExpensiTextInput/BaseExpensiTextInput.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/ExpensiTextInput/BaseExpensiTextInput.js b/src/components/ExpensiTextInput/BaseExpensiTextInput.js index 7194a35fe27c..51aec7021b01 100644 --- a/src/components/ExpensiTextInput/BaseExpensiTextInput.js +++ b/src/components/ExpensiTextInput/BaseExpensiTextInput.js @@ -34,6 +34,12 @@ class BaseExpensiTextInput extends Component { this.onBlur = this.onBlur.bind(this); } + componentDidMount() { + if (this.props.autoFocus && this.input) { + this.input.focus(); + } + } + onFocus() { if (this.props.onFocus) { this.props.onFocus(); } this.setState({isFocused: true}); @@ -84,13 +90,14 @@ class BaseExpensiTextInput extends Component { inputStyle, ignoreLabelTranslateX, innerRef, + autoFocus, ...inputProps } = this.props; const hasLabel = Boolean(label.length); return ( - this.input.focus()}> + this.input.focus()} focusable={false}> Date: Fri, 13 Aug 2021 01:51:09 +0530 Subject: [PATCH 2/2] Update src/components/ExpensiTextInput/BaseExpensiTextInput.js Co-authored-by: Rory Abraham <47436092+roryabraham@users.noreply.github.com> --- src/components/ExpensiTextInput/BaseExpensiTextInput.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/ExpensiTextInput/BaseExpensiTextInput.js b/src/components/ExpensiTextInput/BaseExpensiTextInput.js index 51aec7021b01..791fcb336300 100644 --- a/src/components/ExpensiTextInput/BaseExpensiTextInput.js +++ b/src/components/ExpensiTextInput/BaseExpensiTextInput.js @@ -35,6 +35,7 @@ class BaseExpensiTextInput extends Component { } componentDidMount() { + // We are manually managing focus to prevent this issue: https://github.com/Expensify/App/issues/4514 if (this.props.autoFocus && this.input) { this.input.focus(); }