summaryrefslogtreecommitdiff
path: root/web/src/views/Settings/Common/IdentityVerificationDialog.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'web/src/views/Settings/Common/IdentityVerificationDialog.tsx')
-rw-r--r--web/src/views/Settings/Common/IdentityVerificationDialog.tsx17
1 files changed, 17 insertions, 0 deletions
diff --git a/web/src/views/Settings/Common/IdentityVerificationDialog.tsx b/web/src/views/Settings/Common/IdentityVerificationDialog.tsx
index b9b12f942..7eaa4f129 100644
--- a/web/src/views/Settings/Common/IdentityVerificationDialog.tsx
+++ b/web/src/views/Settings/Common/IdentityVerificationDialog.tsx
@@ -131,6 +131,22 @@ const IdentityVerificationDialog = function (props: Props) {
}
}, [codeInput, handleFailure, handleSuccess]);
+ const handleSubmitKeyDown = useCallback(
+ (event: React.KeyboardEvent<HTMLDivElement>) => {
+ if (event.key === "Enter") {
+ if (!codeInput.length) {
+ setCodeError(true);
+ } else if (codeInput.length) {
+ handleSubmit();
+ } else {
+ setCodeError(false);
+ codeRef.current?.focus();
+ }
+ }
+ },
+ [codeInput.length, handleSubmit],
+ );
+
useEffect(() => {
if (closing || !props.opening || !props.elevation) {
return;
@@ -190,6 +206,7 @@ const IdentityVerificationDialog = function (props: Props) {
error={codeError}
disabled={loading}
inputRef={codeRef}
+ onKeyDown={handleSubmitKeyDown}
/>
</Box>
</DialogContent>