Skip to content

FileList and directories are empty in Chrome #66

@Axionatic

Description

@Axionatic

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 &amp; drop here</h1>
  <div id="input" style="min-height: 10rem; border: 1px solid #000;"></div>
  <script src="https://bundle.run/[email protected]"></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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions