diff --git a/doc/CHANGES.md b/doc/CHANGES.md index 4921608cf..c3c7a2d36 100644 --- a/doc/CHANGES.md +++ b/doc/CHANGES.md @@ -113,6 +113,7 @@ Change log * fix: [#2503](https://github.com/gridstack/gridstack.js/issues/2503) Drag and drop a widget on top of a locked widget - Thank you [JakubEleniuk](https://github.com/JakubEleniuk) * fix: [#2584](https://github.com/gridstack/gridstack.js/issues/2584) wrong sort order during 1 column resize - Thank you [JakubEleniuk](https://github.com/JakubEleniuk) again. * fix: [#2639](https://github.com/gridstack/gridstack.js/issues/2639) load() with mix of new item without coordinates +* fix: [#2633](https://github.com/gridstack/gridstack.js/issues/2633) Drop into full grid causes crash ## 10.1.1 (2024-03-03) * fix: [#2620](https://github.com/gridstack/gridstack.js/pull/2620) allow resizing with sizeToContent:NUMBER is uses diff --git a/spec/e2e/html/2633_drop_full_crash.html b/spec/e2e/html/2633_drop_full_crash.html new file mode 100644 index 000000000..62998c1c6 --- /dev/null +++ b/spec/e2e/html/2633_drop_full_crash.html @@ -0,0 +1,43 @@ + + + + + + + Codestin Search App + + + + +
+

#2633 Drop into full crash

+
+
2x2
+
+

+
+
+ + + + diff --git a/src/gridstack.ts b/src/gridstack.ts index a697771f2..e08117eaa 100644 --- a/src/gridstack.ts +++ b/src/gridstack.ts @@ -2113,7 +2113,7 @@ export class GridStack { dd.droppable(this.el, { accept: (el: GridItemHTMLElement) => { - let node: GridStackNode = el.gridstackNode; + let node: GridStackNode = el.gridstackNode || this._readAttr(el, false); // set accept drop to true on ourself (which we ignore) so we don't get "can't drop" icon in HTML5 mode while moving if (node?.grid === this) return true; if (!this.opts.acceptWidgets) return false; @@ -2125,7 +2125,7 @@ export class GridStack { let selector = (this.opts.acceptWidgets === true ? '.grid-stack-item' : this.opts.acceptWidgets as string); canAccept = el.matches(selector); } - // finally check to make sure we actually have space left #1571 + // finally check to make sure we actually have space left #1571 #2633 if (canAccept && node && this.opts.maxRow) { let n = { w: node.w, h: node.h, minW: node.minW, minH: node.minH }; // only width/height matters and autoPosition canAccept = this.engine.willItFit(n);