Closed Bug 1421333 Opened 7 years ago Closed 5 years ago

Drag end not fired when there is a computation heavy task in drag start

Categories

(Core :: DOM: Copy & Paste and Drag & Drop, defect, P3)

58 Branch
defect

Tracking

()

RESOLVED DUPLICATE of bug 1476195
Tracking Status
firefox57 --- wontfix
firefox58 --- wontfix
firefox59 --- fix-optional

People

(Reporter: georgkothmeier, Unassigned)

Details

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:58.0) Gecko/20100101 Firefox/58.0 Build ID: 20171123161455 Steps to reproduce: When you make an element draggable and assign an event listener for dragstart and dragend, dragend does not fire when a second dragstart is triggered before the dragstart event listener finishes computation. This happens when there is a computation heavy task in the drag start listener. The following fiddle gives an idea how this bug can be triggered: https://jsfiddle.net/xhn5rfrn/2/ In the example fiddle you can reproduce the bug the following way: Drag the yellow box and quickly start another drag (you have to be quicker than the while-loop). The following video demonstrate the issue: https://drive.google.com/file/d/1j9SZQja_W239NDWOvLndhxXm4SbILa0d/view At first I show a working drag. And then what you have to do to break the drag event. This happens with Firefox Quantum 58.0b6 with Mac OS High Sierra 10.13.1 on a MacBook Pro Retina, 15-inch, Mid 2014 (CPU: 2,2 GHz Intel Core i7, RAM: 16 GB 1600 MHz DDR3, GPU: Intel Iris Pro 1536 MB) Actual results: The dragstart event is fired but the dragend never fires Expected results: The dragstart event should fire and after that the dragend event
Component: Untriaged → Drag and Drop
Product: Firefox → Core
This looks like a multiprocess only bug. Likely isn't propagating drag failure between processes at some point.
Priority: -- → P3
@Neil Deakin So you could reproduce the bug on your machine too? Do you have any idea how to work around this issue?

Any updates on this issue? Should it be already resolved?

I wanted to follow up on this issue. Is this resolved in modern Firefox?

Yes this is still a thing in FF67, FF68 and it got even worse in FF69 which completely destroys the D&D event pipeline no matter if you reload or drag again. Only dragstart events will get fired from this point on.
You need to perform a drag & drop in Firefox but outside the concerning tab to repair the D&D state again.

I invested a view hours in my application to come up with this minimal reproducable example.
Just follow the instructions. You may need a view tries. ;)

<html>
	<body>
		<h3>With Firefox &lt;= 69:</h3>
		<ol>
			<li>Drag the red box while not moving the cursor at all</li>
			<li>No concentrate and move the cursor pixel by pixel until DRAGSTART is printed</li>
			<li>In exact this moment release the mouse button</li>
		</ol>
		<h3>Congratulations! You broke the D&D pipeline of Firefox!</h3>
		<p>Only dragstart events will be dispatched from now on. And yes in FF69, you can reload and drag again as much as you want.<br />
		   Once you perform a drag & drop outside of this tab, it will work again.</p>
		<br />
		<hr />
		<div style="background-color: red; display: inline-block; height: 100px; width: 200px;" draggable="true" onDragstart="onDragstart(event)" onDragend="onDragend(event)"></div>
		<hr />
		<button onClick="clearOutput()">Clear output</button>
		<div id="output" style="white-space: pre;"></div>
	</body>
	<script>
		function onDragstart( e ) {
			if( e.dataTransfer ) {
				e.dataTransfer.effectAllowed = 'move';
				e.dataTransfer.setData('text', "");
			}

			document.getElementById('output').innerHTML += "\nDRAGSTART";
		}

		function onDragend( e ) {
			document.getElementById('output').innerHTML += "\nDRAGEND";
		}

		function clearOutput() {
			document.getElementById('output').innerHTML = "";
		}
	</script>
</html>

In my Application (for some reason i don't yet know) the phenomenon occurs far more often and way easier.
The complaint tickets are stacking up since last week. I guess due to the 69 release. Before they could just drag again and everything was back to normal. Now it's quite a mess.

I have not yet found any workaround for this. I tried to mock the dragend event, no effect.
This is critical and i hope this will be solved in the near future. Thanks in advance.

I opened a new bug ticket since this one seems to be too old to get recognized.
https://bugzilla.mozilla.org/show_bug.cgi?id=1580688

We think this will be fixed by 1476195. Please reopen a build with that fix does not fix this issue.

Status: UNCONFIRMED → RESOLVED
Closed: 5 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.