Skip to content

Commit

Permalink
everywhere - clear file input value using an '' instead of null
Browse files Browse the repository at this point in the history
  • Loading branch information
lakesare committed Aug 1, 2024
1 parent f76d744 commit 536bfc9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
3 changes: 2 additions & 1 deletion packages/@uppy/dashboard/src/components/AddFiles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ class AddFiles extends Component {
// ___Why not use value="" on <input/> instead?
// Because if we use that method of clearing the input,
// Chrome will not trigger change if we drop the same file twice (Issue #768).
event.target.value = null // eslint-disable-line no-param-reassign
// eslint-disable-next-line no-param-reassign
;(event.target as HTMLInputElement).value = ''
}

private renderHiddenInput = (isFolder: $TSFixMe, refCallback: $TSFixMe) => {
Expand Down
3 changes: 1 addition & 2 deletions packages/@uppy/drag-drop/src/DragDrop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,8 @@ export default class DragDrop<M extends Meta, B extends Body> extends UIPlugin<
// ___Why not use value="" on <input/> instead?
// Because if we use that method of clearing the input,
// Chrome will not trigger change if we drop the same file twice (Issue #768).
// @ts-expect-error TS freaks out, but this is fine
// eslint-disable-next-line no-param-reassign
event.target.value = null
;(event.target as HTMLInputElement).value = ''
}

private handleDragOver = (event: DragEvent) => {
Expand Down
4 changes: 2 additions & 2 deletions packages/@uppy/file-input/src/FileInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ export default class FileInput<M extends Meta, B extends Body> extends UIPlugin<
// ___Why not use value="" on <input/> instead?
// Because if we use that method of clearing the input,
// Chrome will not trigger change if we drop the same file twice (Issue #768).
// @ts-expect-error yes
event.target.value = null // eslint-disable-line no-param-reassign
// eslint-disable-next-line no-param-reassign
;(event.target as HTMLInputElement).value = ''
}

private handleClick() {
Expand Down

0 comments on commit 536bfc9

Please sign in to comment.