event.dataTransfer.getData return empty string in dragover event

By design Issue #4597368


Sep 15, 2015
This issue is public.
Reported by 1 person

Sign in to watch or report this issue.

Steps to reproduce


Repro Steps:

Paste the following html into a file test.html and open it with IE. When you drag the gray box, text “empty” will appear. But if you do that in Chrome, you will see "testing drag and drop".

<!-- saved from url=(0016)http://localhost -->
<!DOCTYPE html>
<html xmlns=’http://www.w3.org/1999/xhtml’>
<meta http-equiv="X-UA-Compatible" content="IE=10" />
<body id="body">
<div id="data"></div>
<div id="item" draggable="true" style="position:absolute; left: 100px; top: 100px; background-color: #888888; width: 100px; height: 100px;"></div>
var item = document.getElementById(‘item’);
item.addEventListener('dragstart’, function (e) {
e.dataTransfer.setData('Text’, ‘testing drag and drop’);
}, false);
var body = document.getElementById(‘body’);
body.addEventListener('dragover’, function (e) {
var text = e.dataTransfer.getData(‘Text’);
if (text == null || text.length == 0) {
text = 'empty’;
document.getElementById(‘data’).innerText = text;
}, false);

Expected Results:

event.dataTransfer.getData in the dragover event should function the same as that in the drop event.

Actual Results:

Dev Channel specific:



0 attachments

    Comments and activity

    • Microsoft Edge Team

      Changed Assigned To to “Mara P.”

      Changed Assigned To to “Christian F.”

      Changed Assigned To to “Sermet I.”

      Changed Assigned To from “Sermet I.” to “Bruce L.”

      Changed Status to “Confirmed”

      Changed Status from “Confirmed” to “In progress”

      Changed Assigned To from “Bruce L.” to “IE S.”

      Changed Status from “In progress” to “By design”

    • Hello,

      Thank you for providing this information about the issue. Returning an empty string when the data store is in protected mode (as it is for the dragover event) is exactly what the HTML5 DnD spec requires; Chrome is behaving incorrectly. Please update this case if you can provide new information for us to consider.

      Best Wishes,
      The MS Edge Team

    You need to sign in to your Microsoft account to add a comment.

    Sign in