Fix some buttons acting like submits

This commit is contained in:
Alejandro Celaya
2025-04-05 11:23:35 +02:00
parent d8a42b4c3a
commit c29b077e93
3 changed files with 9 additions and 3 deletions

View File

@@ -73,7 +73,7 @@ const CreateServer: FCWithDeps<CreateServerProps, CreateServerDeps> = ({ servers
{!hasServers && ( {!hasServers && (
<ImportServersBtn tooltipPlacement="top" onImport={setServersImported} onError={setErrorImporting} /> <ImportServersBtn tooltipPlacement="top" onImport={setServersImported} onError={setErrorImporting} />
)} )}
{hasServers && <Button variant="secondary" onClick={goBack}>Cancel</Button>} {hasServers && <Button type="button" variant="secondary" onClick={goBack}>Cancel</Button>}
<Button type="submit">Create server</Button> <Button type="submit">Create server</Button>
</ServerForm> </ServerForm>

View File

@@ -44,7 +44,7 @@ const EditServer: FCWithDeps<EditServerProps, EditServerDeps> = withSelectedServ
initialValues={selectedServer} initialValues={selectedServer}
onSubmit={handleSubmit} onSubmit={handleSubmit}
> >
<Button variant="secondary" onClick={goBack}>Cancel</Button> <Button type="button" variant="secondary" onClick={goBack}>Cancel</Button>
<Button>Save</Button> <Button>Save</Button>
</ServerForm> </ServerForm>
</NoMenuLayout> </NoMenuLayout>

View File

@@ -84,7 +84,13 @@ const ImportServersBtn: FCWithDeps<ImportServersBtnConnectProps, ImportServersBt
return ( return (
<> <>
<Button variant="secondary" id="importBtn" className={className} onClick={() => ref.current?.click()}> <Button
type="button"
variant="secondary"
id="importBtn"
className={className}
onClick={() => ref.current?.click()}
>
<FontAwesomeIcon icon={importIcon} fixedWidth /> {children ?? 'Import from file'} <FontAwesomeIcon icon={importIcon} fixedWidth /> {children ?? 'Import from file'}
</Button> </Button>
<UncontrolledTooltip placement={tooltipPlacement} target="importBtn"> <UncontrolledTooltip placement={tooltipPlacement} target="importBtn">