Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

fix(frontend): prevent file upload buttons from triggering form submission (#11576)

Abhimanyu Yadavf8afc6044ed8
diff --git a/autogpt_platform/frontend/src/components/atoms/FileInput/FileInput.tsx b/autogpt_platform/frontend/src/components/atoms/FileInput/FileInput.tsx
index 8f855ad47d..d43063b411 100644
--- a/autogpt_platform/frontend/src/components/atoms/FileInput/FileInput.tsx
+++ b/autogpt_platform/frontend/src/components/atoms/FileInput/FileInput.tsx
@@ -266,6 +266,7 @@ export function FileInput(props: Props) {
size="small"
className="h-7 w-7 min-w-0 flex-shrink-0 border-zinc-300 p-0 text-gray-500 hover:text-red-600 dark:text-gray-400 dark:hover:text-red-500"
onClick={handleClear}
+ type="button"
>
<Cross2Icon className="h-3.5 w-3.5" />
</Button>
@@ -278,6 +279,7 @@ export function FileInput(props: Props) {
onClick={() => inputRef.current?.click()}
className="flex-1 border-zinc-300 text-xs"
disabled={isUploading}
+ type="button"
>
<UploadIcon className="mr-1.5 h-3.5 w-3.5" />
{`Upload ${displayName}`}
@@ -367,6 +369,7 @@ export function FileInput(props: Props) {
<Button
onClick={() => inputRef.current?.click()}
className="min-w-40"
+ type="button"
>
Browse File
</Button>