Skip to content

Commit

Permalink
Merge pull request #1568 from jadu/QU-4501
Browse files Browse the repository at this point in the history
Qu 4501 (round two)
  • Loading branch information
Stanton authored Dec 9, 2024
2 parents d761df7 + 78e4e1e commit f2960b9
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions js/DropZone/DropZone.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,20 @@ export default class DropZone {
if (valid) {
// add processed files to file store
this.files = [...this.files, ...processedFiles];

//We need to manually update the datatransfer.files object as it is not updated by the browser due to security reasons
const dataTransfer = new DataTransfer();
let wasFile = false;
for (let i = 0; i < this.files.length; i++) {
if (this.files[i] && this.files[i].raw instanceof File){
dataTransfer.items.add(this.files[i].raw);
wasFile = true;
}
}
if (wasFile){
// this guard exists as some js tests do not provide a file type as the input value.
document.getElementById(this.options.inputNodeId).files = dataTransfer.files;
}
}

// fire dropped callback
Expand Down

0 comments on commit f2960b9

Please sign in to comment.