Skip to content

Commit

Permalink
fix: "Enter" keypress when using ExternalInput together with ArrayFields
Browse files Browse the repository at this point in the history
Closes #345

ExternalInput and ArrayFields have button elements which assumed
the default type "submit". This causes the buttons to be automatically
triggered when "Enter" keypress happens on other inputs of the form.

Setting their type as "button" instead, fixes the behaviour.
  • Loading branch information
jonduarte committed Mar 23, 2024
1 parent 4c77ac5 commit 5afe5fe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/core/components/ExternalInput/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export const ExternalInput = ({
>
<div className={getClassName("actions")}>
<button
type="button"
onClick={() => setOpen(true)}
className={getClassName("button")}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ export const ArrayField = ({
<div className={getClassNameItem("actions")}>
<div className={getClassNameItem("action")}>
<IconButton
type="button"
disabled={
field.min !== undefined &&
field.min >=
Expand Down Expand Up @@ -292,6 +293,7 @@ export const ArrayField = ({
{provided.placeholder}

<button
type="button"
className={getClassName("addButton")}
disabled={
field.max !== undefined &&
Expand Down

0 comments on commit 5afe5fe

Please sign in to comment.