I have a toolbar with one widget and attributes set to gs-w="1" and gs-h ="1".
When I try to drag and drop the widget inside the grid it usually works fine, but if I accidentally first drag it inside and outside of the grid and then drop it inside, the widget ends up occupying a space that doesn't honour the width and height attributes.
Also, the attributes set into the HTML disappear and from now on, they are completely ignored.
I'm using Gridstack in Angular and the widget toolbar implements BaseWidget class but I also managed to reproduce the issue without Angular, so I don't think Angular makes any difference here.
Dragging a widget from a toolbar should create a widget on the grid that maintains the original attributes (gs-w and gs-h) even if it's dragged inside and outside of the grid many times.
Subject of the issue
I have a toolbar with one widget and attributes set to
gs-w="1"
andgs-h ="1"
. When I try to drag and drop the widget inside the grid it usually works fine, but if I accidentally first drag it inside and outside of the grid and then drop it inside, the widget ends up occupying a space that doesn't honour the width and height attributes. Also, the attributes set into the HTML disappear and from now on, they are completely ignored.I'm using Gridstack in Angular and the widget toolbar implements
BaseWidget
class but I also managed to reproduce the issue without Angular, so I don't think Angular makes any difference here.Your environment
Steps to reproduce
I recreated the bug in this demo: https://jsfiddle.net/gusn6cvy/11/ And here's is a video of the effect:
https://github.com/gridstack/gridstack.js/assets/46027864/2b3ba3c3-65e5-4fee-a901-db9f2c2babe3
Expected behaviour
Dragging a widget from a toolbar should create a widget on the grid that maintains the original attributes (
gs-w
andgs-h
) even if it's dragged inside and outside of the grid many times.