Skip to content

Commit

Permalink
🐛 [#1975] Fix selecting of multiple documents to upload
Browse files Browse the repository at this point in the history
task: https://taiga.maykinmedia.nl/project/open-inwoner/task/1975

the FileInput field now keeps previously selected document after drag and dropping new files to upload
  • Loading branch information
stevenbal committed Jan 5, 2024
1 parent b3fa2d0 commit 2747f6e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/open_inwoner/js/components/form/FileInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ export class FileInput extends Component {
addFiles(files) {
const input = this.getInput()
const dataTransfer = new DataTransfer()
const _files = input.multiple ? [...files] : [files[0]]
// Ensure the previously selected files are added as well
const _files = input.multiple ? [...input.files, ...files] : [...input.files, files[0]]

_files.filter((v) => v).forEach((file) => dataTransfer.items.add(file))
input.files = dataTransfer.files
Expand Down

0 comments on commit 2747f6e

Please sign in to comment.