bevacqua / dragula

:ok_hand: Drag and drop so simple it hurts
https://bevacqua.github.io/dragula/
MIT License
22.01k stars 1.97k forks source link

Documentation usage of "containers" term can confuse user #498

Closed keul closed 4 years ago

keul commented 7 years ago

I'm reporting a documentation issues who hit me in the past; today I found that a customer has been confused in the same way, so I think that something can be done.

The documentation says:

dragula(containers?, options?)

By default, dragula will allow the user to drag an element in any of the containers and drop it in any other container in the list...

The term containers here is not clear. You can be confused and try to pass to dragula a list of containers that match draggable elements.

In brief: if I have something like...

<div class="container">
   <div class="element">element 1</div>
   <div class="element">element 2</div>
</div>

...you can be confused and try to call dragula(document.querySelector('element')).

What probably confuses most: in a simple usecase you only have one container of draggable elements, for a very simple example of usage will be:

dragula([document.querySelector('container')])

But you got an error, as you must to pass an array.

So: my suggestion is that documentation provides an overview of HTML used.

dcantatore commented 4 years ago

document.querySelector('container')

is wrong

document.querySelector('.container')

is correct