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

DragAndDrop doesnt work if dropped on inner HTMLElement #124

Closed
sake402 opened this issue Apr 17, 2020 · 0 comments · Fixed by #126
Closed

DragAndDrop doesnt work if dropped on inner HTMLElement #124

sake402 opened this issue Apr 17, 2020 · 0 comments · Fixed by #126
Assignees

Comments

@sake402
Copy link

sake402 commented Apr 17, 2020

Describe the bug
If the droppable target(span) has inner HTMLElement(img) and file is dropped on inner element(img)
dropReference.EnumerateFilesAsync() is empty. But if dopped on the margin between img and span, it works

To Reproduce

<span class="fileupload" style="" _bl_82097ba2-0b1c-4736-809f-b7fe2ae686ff="">
    <img src="/_content/MyLib/img/building.png" class="image">
</span>

Expected behavior
dropReference.EnumerateFilesAsync() shoud not be empty irrespective of where dropped as long as it is dropped on a child of target

Project type
'Server-side'/'SSB'

Environment

  • Chrome
  • Latest
  • Latest

I tried to debug into the javascript blob and I see that the issue is here

var dataTransfer = this.elementDataTransfers.get(element);
            if (dataTransfer) {
                files = dataTransfer;
            }

dataTransfer is undefined. Looking into the this.elementDataTransfers map, I noticed the key being used for the FileList is img rather than span. Which makes sense as img is the target when dropped.

Backtracked to this line 21

_this.elementDataTransfers.set(ev.target, list);

this.elementDataTransfers.set(ev.target, list);

I think ev.target should have been element which is the ElementReference(span) captured

@sake402 sake402 changed the title DragAndDrop doesnt work if dropped on inner element DragAndDrop doesnt work if dropped on inner HTMLElement Apr 17, 2020
@Tewr Tewr self-assigned this Apr 18, 2020
@Tewr Tewr closed this as completed in #126 Apr 18, 2020
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

Successfully merging a pull request may close this issue.

2 participants