Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#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)

tree_dnd.html (4.8 KB) - added by bill 5 years ago.
standalone version of test case

Download all attachments as: .zip

Change History (7)

comment:1 Changed 5 years ago by alfonsoarc

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:

  • Select an item from the Tree widget.
  • Right click on any item from the Tree to get the context menu.
  • Move the cursor to the left/right immediately afterwards.

comment:2 Changed 5 years ago by bill

Component: GeneralDijit
Owner: set to bill
Summary: Drag in Tree widget initiated without actually dragging on ChromeTree: 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.

Changed 5 years ago by bill

Attachment: tree_dnd.html added

standalone version of test case

comment:3 Changed 5 years ago by bill

comment:4 Changed 5 years ago by alfonsoarc

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 5 years ago by Bill Keese <bill@…>

Resolution: fixed
Status: newclosed

In 1242f594e5009cfe698f29ca2a699f69cc7b5de1/dijit:

Error: Processor CommitTicketReference failed
Unsupported version control system "git": Can't find an appropriate component, maybe the corresponding plugin was not enabled? 

comment:6 Changed 5 years ago by bill

Milestone: tbd1.11
Note: See TracTickets for help on using tickets.