Closed danielweck closed 1 week ago
Ah, I am unable to reproduce with ElectronFiddle, so the regression bug must have arisen from somewhere else!
To test, I added the following event handlers in ElectronFiddle's DOMContentLoaded
template:
document.getElementsByTagName("body")[0].addEventListener("dragover", (event) => {
event.preventDefault();
});
document.getElementsByTagName("body")[0].addEventListener("drop", (ev) => {
ev.preventDefault();
console.log(ev.dataTransfer.files[0].name);
console.log(ev.dataTransfer.files[0].path);
console.log(require("electron").webUtils.getPathForFile(ev.dataTransfer.files[0]));
});
We're using https://www.npmjs.com/package/react-dropzone
The fix was to pass thegetFilesFromEvent
prop to the <DropZone>
component and to simply return Array.from(ev.dataTransfer.files)
... go figure :)
...this is broken on my Mac (running from the develop branch, I tried Electron versions 30...33 so this must be a regression in MacOS Sequoia 15.1)
I filed a bug report but I need a repro test case:
https://github.com/electron/electron/issues/44600
NOTE: the
<input type="file">
still works, the breaking change is only for drag-drop event.