mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-09-30 07:12:36 -05:00
Render button _action value as hidden input
This commit is contained in:
@@ -32,16 +32,24 @@ export function SubmitButton({
|
||||
return undefined;
|
||||
};
|
||||
|
||||
// render action as hidden input to deal with a bug in older Safari versions
|
||||
const isActionValue = name() === "_action";
|
||||
|
||||
return (
|
||||
<Button
|
||||
{...rest}
|
||||
disabled={rest.disabled || isSubmitting}
|
||||
type="submit"
|
||||
name={name()}
|
||||
value={value()}
|
||||
data-testid={testId ?? "submit-button"}
|
||||
>
|
||||
{children}
|
||||
</Button>
|
||||
<>
|
||||
{isActionValue ? (
|
||||
<input type="hidden" name="_action" value={_action} />
|
||||
) : null}
|
||||
<Button
|
||||
{...rest}
|
||||
disabled={rest.disabled || isSubmitting}
|
||||
type="submit"
|
||||
name={!isActionValue ? name() : undefined}
|
||||
value={!isActionValue ? value() : undefined}
|
||||
data-testid={testId ?? "submit-button"}
|
||||
>
|
||||
{children}
|
||||
</Button>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user