Skip to content

Commit

Permalink
fix: don't accidentally perform array list add/remove RJSF actions
Browse files Browse the repository at this point in the history
By setting form buttons as `type=button` explicitly
  • Loading branch information
tomcur committed Feb 19, 2024
1 parent 0c11127 commit 94a6934
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/rjsf-theme/templates/ButtonTemplates/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ function buttonTemplates<
/* a bit hacky to specify the style here */
<Button
{...props}
type="button"
size="small"
variant="muted"
style={{ float: "right", marginRight: "1.2rem" }}
Expand All @@ -41,22 +42,22 @@ function buttonTemplates<
</Button>
),
CopyButton: ({ uiSchema, registry, ...props }) => (
<Button {...props} leftAdornment="+">
<Button {...props} type="button" leftAdornment="+">
Add
</Button>
),
MoveDownButton: ({ uiSchema, registry, ...props }) => (
<Button {...props} size="small" variant="muted">
<Button {...props} type="button" size="small" variant="muted">
<Icon name="arrow down" />
</Button>
),
MoveUpButton: ({ uiSchema, registry, ...props }) => (
<Button {...props} size="small" variant="muted">
<Button {...props} type="button" size="small" variant="muted">
<Icon name="arrow up" />
</Button>
),
RemoveButton: ({ uiSchema, registry, ...props }) => (
<Button {...props} size="small" variant="muted">
<Button {...props} type="button" size="small" variant="muted">
<Icon name="delete" />
</Button>
),
Expand Down

0 comments on commit 94a6934

Please sign in to comment.