1
0
forked from baron/baron-sso

fix(adminfront): fix double-click required for file input in bulk upload modal

Refactored the file input button to use a native HTML label with Radix UI's asChild prop. This ensures the file dialog opens reliably on the first click without relying on JS synthetic click events.
This commit is contained in:
2026-05-20 13:30:29 +09:00
parent 11d535f4e3
commit f4bfa7c129

View File

@@ -416,20 +416,23 @@ export function UserBulkUploadModal({
"템플릿 다운로드",
)}
</Button>
<input
type="file"
accept=".csv"
className="hidden"
ref={fileInputRef}
onChange={handleFileChange}
/>
<Button
onClick={() => fileInputRef.current?.click()}
variant="secondary"
>
{file
? t("ui.common.change_file", "파일 변경")
: t("ui.common.select_file", "파일 선택")}
<Button asChild variant="secondary" className="cursor-pointer">
<label>
{file
? t("ui.common.change_file", "파일 변경")
: t("ui.common.select_file", "파일 선택")}
<input
type="file"
accept=".csv"
className="hidden"
ref={fileInputRef}
onChange={handleFileChange}
onClick={(e) => {
// Allow picking the same file again if it was cleared
(e.target as HTMLInputElement).value = "";
}}
/>
</label>
</Button>
</div>