Opened 7 years ago

Closed 7 years ago

#9210 closed bug (invalid)

Sortable throw weird events when dragging from draggable:connectToSortable

Reported by: Bago Owned by: Bago
Priority: minor Milestone: none
Component: ui.draggable Version: 1.10.2
Keywords: Cc:
Blocked by: Blocking:

Description

The are a lot of differences in the event thrown by draggable.connectToSortable drags and the sortable.connectWith drags.

Developers expect similar behaviours between the two, expecially if they want to intercept those events to do something useful.

Look at this fiddle where I simply log all events for drag and sort operations: http://jsbin.com/utotuq/4/edit

If you take Three, move down over Gamma and come back to the bottom of Gamma and drop you obtain a sequence of events. If you do a similar thing (Take Kiwi, move down over Three and come back to the bottom of Three and drop) starting from draggable you get a very different set/sequence of events.

sortable->connectedsortable:

start
activate x2
change x2
over
change x2
out
beforestop
update
remove
receive
update
deactivate x2
stop

So I get 1 start + 1 stop, 2 activate + 2 deactivate , 1 over and 1 out and everything is correctly sorted in a way a developer can expect/deal with.

If you do the same but starting with a draggable:

draggable->connectedsortable (only sortable events):

activate x2
start
change x5
out
start
beforestop
receive
update
deactivate x2
stop
deactivate

You can see how this is different from the previous.

  • start/stop are not anymore the first and last events.
  • we have 2 activate and 3 deactivate.
  • over event is missing (this is my main problem as I have logic bound to "over")
  • there is a weird "start" call between the "out" and "beforestop".

I tried to intercept some "internal" draggable event (like "fromSortable" "toSortable") in order to try to "predict" the weird events thrown by sortable when dropping a draggable with no success.

I'm willing to investigate the issues and provide a patch but I need some guidance on what you expect (and if you are willing to change the events raised by the plugin). I looked at the code and I understand this is not an easy task. I'm evaluating to create a temporary dom object where to create the copy of the object to be then dragged over the sortable instead of writing the dom inside the first sortable found.

Maybe the best option is to write a new "connecting plugin" instead of fixing "connectToSortable" so that the fixed behaviour can be introduced without breaking existing applications: WDYT?

PS: I tested the jsbin code against 1.8,1.9,1.10,git in chrome and firefox and see the same behaviours in all of them.

Change History (3)

comment:1 Changed 7 years ago by Scott González

I don't think this behavior should change until the rewrite. So that means no changes until 1.13. Feel free to document what you think should happen.

comment:2 Changed 7 years ago by mikesherov

Owner: set to Bago
Status: newpending

comment:3 Changed 7 years ago by trac-o-bot

Resolution: invalid
Status: pendingclosed

Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!

Note: See TracTickets for help on using tickets.