fix: check onKeyUp instead of onKeyDown
This commit is contained in:
@@ -40,6 +40,7 @@ class ChallengeModalCtrl extends PureViewCtrl<unknown, ChallengeModalState> {
|
|||||||
application!: WebApplication;
|
application!: WebApplication;
|
||||||
challenge!: Challenge;
|
challenge!: Challenge;
|
||||||
onDismiss!: () => void;
|
onDismiss!: () => void;
|
||||||
|
submitting = false;
|
||||||
|
|
||||||
/** @template */
|
/** @template */
|
||||||
protectionsSessionDurations = ProtectionSessionDurations;
|
protectionsSessionDurations = ProtectionSessionDurations;
|
||||||
@@ -177,6 +178,10 @@ class ChallengeModalCtrl extends PureViewCtrl<unknown, ChallengeModalState> {
|
|||||||
if (!this.validate()) {
|
if (!this.validate()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (this.submitting) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.submitting = true;
|
||||||
await this.setState({ processing: true });
|
await this.setState({ processing: true });
|
||||||
const values: ChallengeValue[] = [];
|
const values: ChallengeValue[] = [];
|
||||||
for (const inputValue of Object.values(this.getState().values)) {
|
for (const inputValue of Object.values(this.getState().values)) {
|
||||||
@@ -200,6 +205,7 @@ class ChallengeModalCtrl extends PureViewCtrl<unknown, ChallengeModalState> {
|
|||||||
} else {
|
} else {
|
||||||
this.setState({ processing: false });
|
this.setState({ processing: false });
|
||||||
}
|
}
|
||||||
|
this.submitting = false;
|
||||||
}, 50);
|
}, 50);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -378,10 +384,9 @@ function ChallengePrompts({
|
|||||||
ctrl.state.values[prompt.id]!.value = value;
|
ctrl.state.values[prompt.id]!.value = value;
|
||||||
ctrl.onTextValueChange(prompt);
|
ctrl.onTextValueChange(prompt);
|
||||||
}}
|
}}
|
||||||
onKeyDown={(event) => {
|
onKeyUp={(event) => {
|
||||||
if (event.key === 'Enter') {
|
if (event.key === 'Enter') {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
|
||||||
ctrl.submit();
|
ctrl.submit();
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
|||||||
Reference in New Issue
Block a user