Skip to content

Commit

Permalink
Merge pull request #757 from eisbuk/fix/collection-of-fixes-4
Browse files Browse the repository at this point in the history
Make the buttons default to 'type="button"' to prevent form submissio…
  • Loading branch information
ikusteu authored May 2, 2023
2 parents 73e223f + a4b8992 commit 455ac7b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
30 changes: 17 additions & 13 deletions packages/ui/src/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,25 @@ const Button: React.FC<ButtonProps> = ({
children
);

return React.createElement(as, { ...props, className, disabled }, [
startAdornment && (
<div key="start-adornment" className="h-5 shrink-0">
{startAdornment}
</div>
),
return React.createElement(
as,
{ type: "button", ...props, className, disabled },
[
startAdornment && (
<div key="start-adornment" className="h-5 shrink-0">
{startAdornment}
</div>
),

content,
content,

endAdornment && (
<div key="end-adornment" className="h-5 shrink-0">
{endAdornment}
</div>
),
]);
endAdornment && (
<div key="end-adornment" className="h-5 shrink-0">
{endAdornment}
</div>
),
]
);
};

const baseClasses = [
Expand Down
1 change: 1 addition & 0 deletions packages/ui/src/IconButton/IconButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const IconButton: React.FC<IconButtonProps> = ({
...props
}) => (
<button
type="button"
{...props}
title={alt}
className={[
Expand Down

0 comments on commit 455ac7b

Please sign in to comment.