#18526 closed defect (fixed)
Tree: drag initiated after right click then move mouse (Chrome/Ubuntu)
Reported by: | alfonsoarc | Owned by: | bill |
---|---|---|---|
Priority: | undecided | Milestone: | 1.11 |
Component: | Dijit | Version: | 1.10.4 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
I am working on a application that uses a Tree widget with drag and drop capabilities and with support for context menu (using it in conjunction with the Menu widget).
I upgraded dojo recently to 1.10.4 and found that if I right click on one of the Tree items, so that the pop-up menu appears and then move my cursor (without pressing any mouse buttons) to the left or right, the widget thinks that I started a drag operation.
This issue is not present on dojo 1.10.2, which is the version I was using before.
Here there is a small standalone app on JSFiddle, based on the 'Drag and Drop' and 'Context Menu' samples on http://dojotoolkit.org/reference-guide/1.10/dijit/Tree.html where the issue can be reproduced: https://jsfiddle.net/2awokczb/
It is also important to note that this issue is not present on Firefox. I was able to reproduce it on Chrome and Safari.
Attachments (1)
Change History (7)
comment:1 Changed 7 years ago by
comment:2 Changed 7 years ago by
Component: | General → Dijit |
---|---|
Owner: | set to bill |
Summary: | Drag in Tree widget initiated without actually dragging on Chrome → Tree: drag initiated after right click then move mouse (Chrome/Ubuntu) |
OK, I'm not going to install Ubuntu but perhaps I can help you debug it.
In https://github.com/dojo/dijit/blob/master/tree/dndSource.js, onMouseMove()
has this code that starts the drag operation:
if(this.mouseDown && this.isSource && (Math.abs(e.pageX - this._lastX) >= this.dragThreshold || Math.abs(e.pageY - this._lastY) >= this.dragThreshold)){
Now, you wrote:
I upgraded dojo recently to 1.10.4 and found that if I right click on one of the Tree items, so that the pop-up menu appears and then move my cursor (without pressing any mouse buttons) to the left or right, the widget thinks that I started a drag operation.
Do you mean that you do a (1) mouse down and then a (2) mouse up followed by (3) the mouse move?
If so, the above if()
statement shouldn't execute because this.mouseDown
should be false. I'm guessing though it's true for you? Maybe the Tree isn't seeing the mouseup event because it's getting sent to the Menu.
Admittedly, the onMouseDown()
and onMouseUp()
methods in https://github.com/dojo/dijit/blob/master/tree/dndSource.js should only work for left click. dojo/dnd/Source.html has code for that in its legalMouseDown()
method. So probably Tree should do something similar.
If you can try that and it fixes your problem, then I'll roll it into the Tree code.
comment:4 Changed 7 years ago by
I tried the code in your pull request and I can confirm that it fixes the problem on Ubuntu. You can roll it into the Tree code.
Thank you very much for your response. It is highly appreciated.
comment:5 Changed 7 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:6 Changed 7 years ago by
Milestone: | tbd → 1.11 |
---|
I have just tested this on Windows 7 / Chrome and the issue is not present there.
I found the bug on Ubuntu 14.04.
It is also worth noting that sometimes it is necessary to first select an item from the Tree widget to be able to reproduce the issue, so the steps in this case would be: