Skip to content

Commit

Permalink
minor adjustments to MagicCodeInput
Browse files Browse the repository at this point in the history
  • Loading branch information
Pujan92 committed Jul 28, 2023
1 parent e7b3e97 commit 5488702
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
10 changes: 1 addition & 9 deletions src/components/MagicCodeInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,17 +106,9 @@ function MagicCodeInput(props) {
setFocusedIndex(undefined);
};

const focusMagicCodeInput = () => {
inputRefs.current[0].focus();
};

useImperativeHandle(props.innerRef, () => ({
focus() {
focusMagicCodeInput();
},
resetFocus() {
setInput('');
focusMagicCodeInput();
inputRefs.current[0].focus();
},
clear() {
inputRefs.current[0].focus();
Expand Down
2 changes: 1 addition & 1 deletion src/pages/signin/ValidateCodeForm/BaseValidateCodeForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ function BaseValidateCodeForm(props) {
if (!input2FARef.current || prevRequiresTwoFactorAuth || !props.account.requiresTwoFactorAuth) {
return;
}
input2FARef.current.resetFocus();
input2FARef.current.focus();
}, [props.account.requiresTwoFactorAuth, prevRequiresTwoFactorAuth]);

useEffect(() => {
Expand Down

0 comments on commit 5488702

Please sign in to comment.