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

Drag and Drop from tree to other container not working in Firefox any more #161

Closed
BjrnS opened this issue Oct 2, 2018 · 6 comments
Closed
Assignees
Labels
Milestone

Comments

@BjrnS
Copy link

BjrnS commented Oct 2, 2018

Hi,

since a few Firefox versions it is not possible to drag a node out of a tree onto another dojo/dnd/Source element to drop it there. The drop allowed indicator does not appear, releasing the mouse button over the element acts as if the mouse is over any other non-dnd element.
Dnd within the tree works, so it seems like it is not a general problem.
With Chrome and Edge the mechanism works as intended.

Observations:

  • I think the Firefox version that first had this problem was the version that introduced their implementation of the pointer api
  • it seems like none of the mouseOver / mouseEnter events are triggered for the target container. I tried to identify which of the e.stopPropagation(); e.preventDefault(); in dojo/dnd and dijit/tree might be responsible, but had no luck with that approach

the issue was reported here: https://discourse.dojo.io/t/drag-and-drop-not-working-with-firefox-dojo-1-13/201 as well.

I have hacked together a single page example of the issue, you can reach it here: https://misc.digicult-verbund.de/tests/ff_tree.html

@dylans dylans added this to the 1.14.3 milestone Oct 4, 2018
@dylans dylans added the bug label Oct 4, 2018
@dylans
Copy link
Member

dylans commented Oct 4, 2018

Thanks @BjrnS for the test case, we'll look into this as soon as possible.

@edhager edhager self-assigned this Oct 11, 2018
@BjrnS
Copy link
Author

BjrnS commented Dec 12, 2018

may I ask if you still plan to look into it and ideally if a fix will be coming?

@edhager
Copy link
Contributor

edhager commented Jan 7, 2019

Hi @BjrnS, I am looking at it now.

So far, it looks like basic Dojo Dnd is working in Firefox:

<div>Pick here:</div>
<ol class="box" data-dojo-type="dojo/dnd/Source">
    <li class="dojoDndItem">Item 1</li>
    <li class="dojoDndItem">Item 2</li>
    <li class="dojoDndItem">Item 3</li>
</ol>
<div>Drop here:</div>
<ol class="box" data-dojo-type="dojo/dnd/Target">
</ol>

I'll dive into the test case and see if I can figure out what's broken.

@edhager
Copy link
Contributor

edhager commented Jan 8, 2019

Here is what I know... In Firefox, when you click on an item and start dragging, this event handler fires for ALL mouse movements even when the point moves outside of the container node:

on(this.tree.domNode, touch.move, lang.hitch(this,"onMouseMove")),

In Chrome, that event handler stops firing as soon as the mouse leaves the tree container node. So in Firefox, the Dojo/Dijit code receives no other events as you drag an item in the tree to another container. Drag and drop works within the tree because that event handler handles movement within the tree.

I've tried to replicate this problem with a simpler test case without success. My thought was if this is a Firefox bug, I would need a much simpler test case to demonstrate it.

@ChangdongLi
Copy link

the root cause may be related to a known bug in dojo/touch, see https://dojotoolkit.org/reference-guide/1.10/dojo/touch.html
"If a device has both mouse and touch (like Blackberry phones or some high end desktop computers), dojo/touch will only monitor touch events; ideally it should be monitoring both"

if I disable the touch screen, drag and drop works for me in firefox and chrome.

@msssk
Copy link
Contributor

msssk commented Jan 11, 2019

This can be fixed with some CSS:

.dijitTree {
    -moz-user-select: none;
}

We are working on fixing this in Dijit.

msssk added a commit to msssk/dijit that referenced this issue Feb 2, 2019
dijit/Tree and dojo/dnd/Manager both have selectstart handlers that prevent
selection, and they are generally working. In Firefox, although the events
fire and prevent actual content selection, they mess up mouse events to the
point that while the canceled selection is happening the target for all pointer
events is the node in which selection started. So when you drag an item out of
the tree and into a DnD target, Firefox doesn't register that happening as it
thinks you're still selecting things in the Tree.
edhager pushed a commit that referenced this issue Feb 7, 2019
dijit/Tree and dojo/dnd/Manager both have selectstart handlers that prevent
selection, and they are generally working. In Firefox, although the events
fire and prevent actual content selection, they mess up mouse events to the
point that while the canceled selection is happening the target for all pointer
events is the node in which selection started. So when you drag an item out of
the tree and into a DnD target, Firefox doesn't register that happening as it
thinks you're still selecting things in the Tree.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants