Skip to content

item can overlap calling update() and locked items #1959

Closed

Description

@giantroboticcat

Subject of the issue

When using GridStackEvent.update to move an item upwards in the y direction the collision detection allows grid-items to overlap

Your environment

  • Gridstack 5.0 HTML5 Native
  • Chrome Version 100.0.4896.127
  • Windows 10

Steps to reproduce

Press any of the shift up buttons and notice how the moveable object intercepts other locked grid-items.
https://jsfiddle.net/e0nstd53/1/

Expected behavior

Item either skips above the locked item (such as the case when shifting down), or the item does not move at all.

Actual behavior

Items overlap

Activity

  1. adumesny commented on Apr 29, 2022

    @adumesny
    Member

    thanks for the bug report. can you make sure it still happens with latest rev ? (5.0.0)
    I'm guessing this is only and issue with locked items (which should fail to move).

  2. giantroboticcat commented on Apr 29, 2022

    @giantroboticcat
    Author

    Correct it's only an issue with locked items. Unlocked items behave as you would expect.

    I can also confirm this issue persists on 5.0.0.

    Sorry I didn't realize the fiddle I usurped to make the demo wasn't using latest rev. Here is an updated fiddle pointing at latest rev and behavior remains the same.

    https://jsfiddle.net/bhkm95gt/1/

    I also want to note that I am currently working around the issue by using the isAreaEmpty api call to check if the update should proceed. It works to prevent the overlap, but it obviously stops any sort of skip over code from executing. As such it simply serves to cover the "item does not move at all" expected behavior... although that is certainly less ideal than having the item skip over to a valid area above the item.

  3. adumesny commented on Apr 29, 2022

    @adumesny
    Member

    if you move up by 1 and it has a locked item, it should fail to move and stay put (moving above - you can do that manually by moving enough past 1 to mean ok go before that locked items, but doing similar heuristics (say move by 2 but you really need 3 to clear a locked item) would be much harder to implement...

    if you want to donate something, I can probably find some time, but I'm really swamped these days otherwise... you might be able to work around it by checking the item at that location and checking for lock (not just empty)

  4. changed the title [-]Grid items are allowed to overlap when moving upwards during an update event[/-] [+]item can overlap calling update() and locked items[/+] on Sep 17, 2022
  5. added a commit that references this issue on Sep 29, 2026
    d46f09c
  6. added a commit that references this issue on Sep 29, 2026
    1da152a
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