Skip to content

Commit

Permalink
chore(data-warehouse): submit form on enter (PostHog#23925)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
2 people authored and silentninja committed Aug 8, 2024
1 parent 4970bec commit ec2bfeb
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion frontend/src/lib/lemon-ui/LemonDialog/LemonDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,15 @@ export const LemonFormDialog = ({
}, [])

return (
<Form logic={lemonDialogLogic} formKey="form">
<Form
logic={lemonDialogLogic}
formKey="form"
onKeyDown={(e: React.KeyboardEvent<HTMLFormElement>): void => {
if (e.key === 'Enter' && primaryButton?.htmlType === 'submit' && isFormValid) {
void onSubmit(form)
}
}}
>
<LemonDialog {...props} primaryButton={primaryButton} secondaryButton={secondaryButton} />
</Form>
)
Expand Down

0 comments on commit ec2bfeb

Please sign in to comment.