dojo / widget-core

:rocket: Dojo 2 - widget authoring system.
http://dojo.io
Other
34 stars 39 forks source link

Drag Meta keeps tracking drag after right click #717

Closed tomdye closed 6 years ago

tomdye commented 6 years ago

Bug

Package Version: current

Expected behavior:

When you right click the mouse the drag meta should not track the drag as the pointer event is managed by the context menu at that point.

Actual behavior:

Drag meta treats the right mouse click as a drag and gets confused once the context menu has been closed continuing to drag the mouse movement until left mouse button is clicked.

kitsonk commented 6 years ago

On the start of the drag, we currently do not inspect if it is a single finger or a left mouse button. That means if something is being tracked by the Drag meta manager, the Drag state for that node starts. Because we use the capture phase on subsequent move and mouse up events (to ensure that we get the the proper target on subsequent events), any other items created "block" those events from being attributed back to the target. Filtering only single finger/left clicks should solve this particular problem, but if we end up with other issues, we might want to change the drag manager to ensure only one virtual DOM element can be in a drag state and other pointer events not attributable to that DOM node kill the drag state.

kitsonk commented 6 years ago

The fix is the fix, but thinking more about what I also said about other fixes, those won't work. Once we enter a drag state, all subsequent events are attributed to that until the pointer up. It already ensures only one virtual DOM element can be in a drag state.