Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Working set drag stop when moving mouse quickly #4920

Closed
peterflynn opened this issue Aug 24, 2013 · 9 comments
Closed

Working set drag stop when moving mouse quickly #4920

peterflynn opened this issue Aug 24, 2013 · 9 comments

Comments

@peterflynn
Copy link
Member

  1. Mousedown on something near the bottom of the working set
  2. Drag upward quickly to the top of the list

Result:
Item moves up one notch, then stops moving. The item won't move any further until you mouseup.

Expected:
Works just as well as dragging slowly.

@ghost ghost assigned peterflynn Aug 24, 2013
@peterflynn
Copy link
Member Author

To me since I think I see where the bug is...

@TomMalbran
Copy link
Contributor

I've been noticing this too. It is because of the recently added mouseleave event. Since you are moving the mouse quickly, you end up leaving the element and triggering this event, which drops the item.

@njx
Copy link
Member

njx commented May 5, 2014

Just ran into this again. Looks like this didn't have a priority...marking low.

@njx
Copy link
Member

njx commented May 5, 2014

Seems like the fix should be to use a capture handler on the move events (so it works even if you happen to drag slightly outside the container), and not paying attention to mouseleave (which shouldn't matter - we should only care when you actually let go of the mouse, I think).

@TomMalbran
Copy link
Contributor

I did some debugging and found the issue, which is actually a race condition.

  • When dragging slowly: After moving the item 3px _suppressSortRedraw is set to true. When the items are swapped, the workingSetSort event is triggered which will call _handleWorkingSetSort where it recreates the working set when _suppressSortRedraw is false. So in this case it does nothing, and everything works. Notice that after moving the item slowly for the first pixels, you can move it fast again.
  • When dragging fast: The workingSetSort event is triggered before _suppressSortRedraw is set to true. So the working set is rebuild and all the saved jQuery items are no longer valid, which means that we are no longer dragging the new item.

Issue #5999 is different from this one, since there is actually a mouseleave listener that drops the item when moving the mouse outside of the working set container. It looks like it was a suggestion by redmunds 2years ago: #1846 (comment)

@TomMalbran
Copy link
Contributor

@njx @peterflynn Is this marked as fix in progress because of my comment or is someone else working on it? If no one is working on it, I can try to fix it.

@njx
Copy link
Member

njx commented May 9, 2014

Not sure - I don't remember if I marked it for some reason, but I don't think so. Anyway, if no one else chimes in, please go ahead - it's been bugging me :)

@TomMalbran
Copy link
Contributor

Ok. I think i have an easy fix for this issue and #5999. I should just test that it won't break anything.

@peterflynn
Copy link
Member Author

Closing -- fixed now that PR #7820 has landed

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants