diff --git a/packages/libeufin-bank-webui/src/pages/SolveMFA.tsx b/packages/libeufin-bank-webui/src/pages/SolveMFA.tsx index b54f6a43d..4fcd390e6 100644 --- a/packages/libeufin-bank-webui/src/pages/SolveMFA.tsx +++ b/packages/libeufin-bank-webui/src/pages/SolveMFA.tsx @@ -478,6 +478,10 @@ function SolveMFAChallenges({ const hasSolvedEnough = currentChallenge.combi_and ? currentSolved.length === currentChallenge.challenges.length : currentSolved.length > 0; + // The dialog opens while keyboard focus is still on the button that + // started the operation, behind the overlay, where Enter would submit it + // again. Move focus to the first challenge that still has to be done. + let focusPending = !!focus; return ( @@ -543,6 +547,8 @@ function SolveMFAChallenges({ solved.indexOf(challenge.challenge_id) !== -1 || (currentChallenge.combi_and && nextAndChallenge?.challenge_id !== challenge.challenge_id); + const focusHere = focusPending && !noNeedToComplete; + if (focusHere) focusPending = false; return (
selectChallenge.run(challenge)} > I have a code + {/* Not tied to alreadySent: focusing the disabled + button does nothing, while a ref that changes + when the retransmission wait ends would steal + focus later. */} sendMessage.run(challenge)} >