fix(react): button not working as submit

This commit is contained in:
Elian Doran
2025-08-03 20:01:54 +03:00
parent 4d09fabad8
commit 164feaa3ec

View File

@@ -4,6 +4,7 @@ interface ButtonProps {
text: string; text: string;
className?: string; className?: string;
keyboardShortcut?: string; keyboardShortcut?: string;
/** Called when the button is clicked. If not set, the button will submit the form (if any). */
onClick?: () => void; onClick?: () => void;
} }
@@ -20,7 +21,7 @@ export default function Button({ className, text, onClick, keyboardShortcut }: B
return ( return (
<button <button
className={classes.join(" ")} className={classes.join(" ")}
type="button" type={onClick ? "button" : "submit"}
onClick={onClick} onClick={onClick}
ref={buttonRef} ref={buttonRef}
> >