FileList and directories are empty in Chrome
Axionatic opened this issue · 0 comments
Axionatic commented
When using Chrome, both the fileList object and the directories array passed to drag-drop's callback function appear to be empty. Firefox is still working fine, I haven't been able to test Safari as I don't have a Mac.
This was previously working; I assume some kind of new security enhancement on Chrome or WebKit is to blame.
To replicate:
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<title>Drag & Drop</title>
</head>
<body>
<h1>drag & drop here</h1>
<div id="input" style="min-height: 10rem; border: 1px solid #000;"></div>
<script src="https://bundle.run/drag-drop@7.2.0"></script>
<script src="app.js"></script>
</body>
</html>
app.js
dragDrop('#input', (files, pos, fileList, directories) => {
console.log('Here are the dropped files', files);
console.log('Dropped at coordinates', pos.x, pos.y);
console.log('Here is the raw FileList object if you need it:', fileList);
console.log('Here is the list of directories:', directories);
});
Note console output on drag & drop:
Here are the dropped files
(3) [File, File, File]
0: File {fullPath: "/1.jpg", isFile: true, isDirectory: false, name: "1.jpg", lastModified: 1564034283085, …}
1: File {fullPath: "/2.jpg", isFile: true, isDirectory: false, name: "2.jpg", lastModified: 1564034283085, …}
2: File {fullPath: "/3.jpg", isFile: true, isDirectory: false, name: "3.jpg", lastModified: 1564034283085, …}
length: 3
[[Prototype]]: Array(0)
Dropped at coordinates 729 163
Here is the raw FileList object if you need it:
FileList {length: 0}
length: 0
[[Prototype]]: FileList
Here is the list of directories:
[]
length: 0
[[Prototype]]: Array(0)
Is this something that can be fixed? Or are whatever security change(s) responsible insurmountable?