Electron ondrop and ondrag- events not firing

Viewed 251

I'm trying to let users just drop a file into the main window instead of having to click on the input form, and I'm completely stumped.

None of the drag and drop events appear to be firing in electron 6.14.5.

Here is my code, it works just fine in browsers, and most solutions I find online involve requiring preventDefault(), but I don't think the "Default" being prevented is even is happening in the first place, and including or excluding makes no difference.

let input = document.getElementById('inbox');

input.ondragenter = function (e) {
    e.preventDefault()
    console.log('dragenter')
};
input.ondragleave = function (e) {
    e.preventDefault()
    console.log('ondragleave')
};

input.ondragover = function (e) {
    e.preventDefault()
    console.log('ondragover')
}

input.ondrop = function (e) {
    e.preventDefault()
    console.log('ondrop')
};
<div id="inbox">
Source Data:
<input type="file" id="fileInput" name="inputter">
</div>

Update: I have discovered that the ondrag* events are actually firing, however they only doing so if I drag an element from within the electron window. If I try to drag in a file from the OS it doesn't respond at all, and actually it may be worth noting that as soon as I try to drag something my mouse cursor turns into the prohibited symbol ()

Is there some window setting that would be blocking this?

0 Answers
Related