Skip to content

Widget resets into illegal position when released out of bounds following a swap (using maxRow) #3021

Closed

Description

@arjenvklaveren

Description:
While working with the library I noticed that sometimes my widgets completely dissapeared, and after some investigating I discovered that they are not deleted, but rather overlap with eachother. This behaviour happens when an item gets reset out of bounds after it has swapped with another widget. I tried to find the root of the problem, which seems to be caused by me using the maxRow setting, specifically maxRow = 1, but it most likely also occurs with other amounts. This behaviour does not happen without the maxRow limitation, as it then instead pushes the other widget down vertically. The problem can be observed in the 'two vertical grids' demo: https://gridstackjs.com/demo/two_vertical.html

Steps to reproduce:

  • Open the 'two vertical grids' demo
  • Start dragging a widget
  • Drag over another widget (in the same grid), triggering them swapping
  • Drag the widget outside of bounds, resetting it
  • The widget is now behind the other widget

Expected behaviour:

  • The state of the grid should get reset to before the widget gets dragged (without the swapping)
  • Or, the other widget gets pushed horizontally instead (which I imagine is quite troublesome to implement)

Activity

  1. adumesny commented on Apr 14, 2025

    @adumesny
    Member

    adding pictures to these steps:

    Image
    start dragging item 1 to left
    Image
    drag out and release outside
    Image
    you end up overlapping (item 1 goes back to original instead of last placeholder OR reset original layout)
    Image

    this is rather corner case

  2. added a commit that references this issue on Aug 10, 2025
    13680fc
  3. adumesny commented on Aug 10, 2025

    @adumesny
    Member

    fixed in next release. don't foret to donate if you find this lib useful!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions