Opened 8 years ago

Closed 6 years ago

#7167 closed feature (wontfix)

Draggable: dropOnEmpty option or Sortable: repurpose same

Reported by: Altreus Owned by:
Priority: minor Milestone: 2.0.0
Component: ui.draggable Version: 1.8.11
Keywords: Cc:
Blocked by: Blocking:


I found a (brief!) discussion on whether dropOnEmpty should exist on Sortable. The answer was no.

It is useful; but it's the wrong way around. Currently in order to prevent a connected Draggable from being dropped on an empty sortable you have to disable the sortable whenever it becomes empty and re-enable it if it gains content (on the theory that drag+drop is not the only way of creating DOM content).

I would propose that dropOnEmpty should apply to the sortable itself, as to whether it will accept a droppable if it is empty; rather than whether its own items can be dropped onto empty others.

Alternatively, the options to Draggable should have a dropOnEmpty that does the same thing as Sortable's; i.e. prevents this draggable being dropped on an empty sortable.

The former, while preferable in my mind, has the disadvantage of not being backward-compatible.

Change History (4)

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

Type: enhancementfeature

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


comment:3 Changed 7 years ago by Jörn Zaefferer

Status: newopen

Should take this usecase into account for 2.0.0, even though the APIs for interacting with draggable and sortable are likely to change a lot.

comment:4 Changed 6 years ago by Scott González

Resolution: wontfix
Status: openclosed

We're not going to add any drop on empty logic in the rewrite. This will need to be implemented in your app-specific logic using the provided APIs for connecting, e.g., by toggling a class when the sortable is empty.

Note: See TracTickets for help on using tickets.