Skip to content

Commit 30435f0

Browse files
atmelmicrobedrich-schindler
authored andcommitted
Reset the internal input value when the reset button is clicked in FileInputField (#641)
Not resetting the internal input value will cause the input to not register any files if the user had clicked "Browse", then resetted the field and again clicked "Browse" and selected a file. The 2nd file would not have a event fired for this. This did not affect drag and drop.
1 parent 980056e commit 30435f0

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/components/FileInputField/FileInputField.jsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ export const FileInputField = React.forwardRef((props, ref) => {
4747
const internalInputRef = useRef();
4848

4949
const handleReset = useCallback((event) => {
50+
if (internalInputRef.current) {
51+
internalInputRef.current.value = '';
52+
}
53+
5054
setSelectedFileNames([]);
5155
onFilesChanged([], event);
5256
}, [onFilesChanged]);

0 commit comments

Comments
 (0)