-
Notifications
You must be signed in to change notification settings - Fork 96
Conflict with drag and drop file upload #25
Comments
If you can take a look at what it would take to make a pull request that handles this case correctly, we might merge it. Unfortunately you’re on your own there because I don’t currently have time to work on this. |
@gaearon removing line 446 and line 426 all together fixes the issue. furthermore, if we are dragging a native item type, dropEffect is actually already set to none (at least, in Chrome 55.0.2). so i don't expect removing these lines to introduce any issues. your 2 cents? if this sounds OK to you i can submit a pull request. |
I am having a similar issue. I think the root cause is the same so I didn't file a separate issue. In my case, I'm having a piece of UI that is split into tabs. One tab has React DND re-arrangable photos, the other tabs have React Dropzone to upload some files. What I've found is that after adding React DND, it's all rendered together (thus event binding from both libs are in effect). This for me results in the React Dropzone not working. When I drag files into the dropzone, it highlights (dragover etc. events work ok), but when I drop, the files are not handled at all, just "return" (kinda like they were rejected). See: I've identified the problem to be somewhere in What I've found is that addEventListeners function takes A crude fix: in
This is somewhat related to react-dnd/react-dnd#632, but my problem is not multiple global window instances (as in juggling iframes etc.), but merely limiting the DND to a specific DOM element.
Any hints, @darthtrevino ? |
Alright, small update: I was able to solve my problem using react-dnd/react-dnd#632 addition of the
So my current simplest suggestion would be to rename this I don't see |
Interesting, I'm not necessarily opposed to this idea, but is there anything preventing you from just using the |
@awinecki are you certain it's not handleTopDragOver as the original filing suggests (and where i found the issue)? and would you be willing to try the fix i suggested? also, if it's the same issue, i would wager that even with DragDropContextProvider, native file uploads would still fail so long as they are children of a DragDropContext. edit: @darthtrevino the DragDropContext kills native file uploads. putting it on the top level prevents handleDrop (of a native file) from firing anywhere. see my comment here: react-dnd/react-dnd#457 (comment) |
I'm having the same problem as @yesmeck and @kn0ll. More precisely, in https://github.com/react-dnd/react-dnd-html5-backend/blob/v2.1.2/src/HTML5Backend.js#L486-L487 |
@kn0ll I've tried your
Whereas my issue is the fact that HTML5Backend binds events like dragstart, dragend, dragenter, drop, dragover on global
I'm not sure I know what you mean. If by top level you mean top of my React app, then I must say I don't have a SPA, but rather hybrid codebase, so my other Dropzone is rendered separately by another Though again, using Here's an illustration:
|
I think the issue is even more pervasive than so far described. The global binding on the drag events seems to prevent even native controls from working for me. For instance, in an input field you should be able to select text and drag it around within the field. When React-DND is enabled this behavior is broken in my app. I'll try out the DragDropContextProvider to see if it solves the issue. |
@scottfr: I'm having the same issue - did you ever find a solution? |
No, I've been unable to find a solution. |
Same issue here. The DragDropContextProvider doesn't work for me, because it has to be at top level app component. When used somwhere below the top level, it gives this error: react-dnd/react-dnd#858. |
I have a drag and drop file upload area in the
DragDropContext
, but the handleTopDragOver prevents the drag event which makes my drag and drop upload component not working.Any workaround to solve the problem?
The text was updated successfully, but these errors were encountered: