Skip to content

Commit

Permalink
fix upload button
Browse files Browse the repository at this point in the history
  • Loading branch information
MysterionAutotronic committed Jun 10, 2024
1 parent 5b4058a commit 54dc59c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/pages/Commit/components/LocalizedFileInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ const LocalizedFileInput: React.FC<LocalizedFileInputProps> = ({ onChange, accep
onChange(event);
};

/**
* Trigger the actual hidden file input element to open the file dialog.
* @author David Linhardt
*/
const triggerFileInputClick = () => {
document.getElementById('fileInput')?.click();
};

return (
<div>
<input
Expand All @@ -63,7 +71,7 @@ const LocalizedFileInput: React.FC<LocalizedFileInputProps> = ({ onChange, accep
data-testid="fileUpload"
/>
<label htmlFor='fileInput' className='custom-file-input'>
<button className="button" type="button">
<button className="button" type="button" onClick={triggerFileInputClick}>
{t('browse')}
</button>
</label>
Expand Down

0 comments on commit 54dc59c

Please sign in to comment.