Skip to content

Commit 7ad576e

Browse files
committed
fix: add prevent default in infra form submit to prevent submit on enter
1 parent 118e17b commit 7ad576e

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

src/Pages/GlobalConfigurations/BuildInfra/ProfileForm.tsx

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,20 @@ const ProfileForm: FunctionComponent = () => {
3535
[profileInputErrors],
3636
)
3737

38+
const handleKeyDown = (event: React.KeyboardEvent<HTMLFormElement>) => {
39+
if (event.key === 'Enter') {
40+
event.preventDefault()
41+
}
42+
}
43+
3844
const showActionItems = !isLoading && !responseError && profileInput?.configurations
3945

4046
return (
41-
<form className="h-100 flexbox-col build-infra pl pr pt pb dc__content-space bcn-0" onSubmit={handleSubmit}>
47+
<form
48+
className="h-100 flexbox-col build-infra pl pr pt pb dc__content-space bcn-0"
49+
onKeyDown={handleKeyDown}
50+
onSubmit={handleSubmit}
51+
>
4252
<div className="flexbox-col dc__gap-24 pt pr pb pl h-100 dc__overflow-scroll">
4353
<BuildInfraDescriptor breadCrumbs={breadcrumbs} />
4454

@@ -67,12 +77,7 @@ const ProfileForm: FunctionComponent = () => {
6777
</div>
6878

6979
{showActionItems && (
70-
<BuildInfraFooter
71-
disabled={formErrorCount !== 0}
72-
hideCancelButton
73-
editProfile
74-
loading={loadingActionRequest}
75-
/>
80+
<BuildInfraFooter disabled={formErrorCount !== 0} editProfile loading={loadingActionRequest} />
7681
)}
7782
</form>
7883
)

0 commit comments

Comments
 (0)