Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FileList and directories are empty in Chrome #66

Open
Axionatic opened this issue Jul 24, 2021 · 0 comments
Open

FileList and directories are empty in Chrome #66

Axionatic opened this issue Jul 24, 2021 · 0 comments

Comments

@Axionatic
Copy link

Axionatic commented Jul 24, 2021

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant