fix: pressing enter on authentication modal not submitting form

This commit is contained in:
Antonella Sgarlatta
2021-05-17 16:49:43 -03:00
parent a2b6c3785a
commit 87305c8071

View File

@@ -374,7 +374,10 @@ function ChallengePrompts({
</div>
) : (
<div key={prompt.id} className="sk-panel-row">
<form className="w-full">
<form className="w-full" onSubmit={(event) => {
event.preventDefault();
ctrl.submit();
}}>
<input
className="sk-input contrast"
value={ctrl.state.values[prompt.id]!.value as string | number}
@@ -383,12 +386,6 @@ function ChallengePrompts({
ctrl.state.values[prompt.id]!.value = value;
ctrl.onTextValueChange(prompt);
}}
onKeyUp={(event) => {
if (event.key === 'Enter') {
event.preventDefault();
ctrl.submit();
}
}}
ref={index === 0 ? initialFocusRef : undefined}
placeholder={prompt.title}
type={prompt.secureTextEntry ? 'password' : 'text'}