TahaSh / swapy

✨ A framework-agnostic tool that converts any layout into a drag-to-swap one with just a few lines of code https://swapy.tahazsh.com/
MIT License
5.86k stars 114 forks source link

Swapy does not work properly if the layout it's a non-linear layout #56

Open Angel-Ponce opened 1 month ago

Angel-Ponce commented 1 month ago

I have the following HTML structure

<section swapy-container>
    <div class="group-1">
        <div swapy-slot>
            <div swapy-item></div>
        </div> 

        <div swapy-slot>
            <div swapy-item></div>
        </div>     
    </div>

    <div class="group-2">
        <div swapy-slot>
            <div swapy-item></div>
        </div>  

        <div swapy-slot>
            <div swapy-item></div>
        </div>    
    </div>
</section>

As you can see the "group-1" and "group-2", or "group-n" wraps multiple swapy slots/items into div, it crashes the result, see the behaviour of swapy:

https://github.com/user-attachments/assets/2286e34a-21a0-474a-9d5e-4cd79359662b

Merglodov commented 2 days ago

I have the same, with a bit more complex data inside slot it becomes unstable immediately even without dragging.