-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SetupDragIn not working inside the web component #2275
Comments
or we could make |
* fix gridstack#2275 * `setupDragIn()` now can take an array or elements (in addition to selector string) and optional parent root (for shadow DOM support)
I didn't get to test it, but this should handle it in the next release. |
thanks @adumesny! upgraded to V8.0.1, and tested, works like a charm :) |
curious, are you passing a list of elements or the virtual DOM parent ? |
tested both, and I'm passing a list of elements like the below snip... `const availableWidgets = this.querySelectorAll(".newWidget");
Just thought, for Passing the root element as a param I think we can define a better type instead of the Document type currently tested the below snip works fine, but found during debugging inside Util.getElement in some specific condition, we using root.getElementById that might not be available for HTMLElement...
|
good point. |
* set root: HTMLElement | Document so either can be passed now more fix gridstack#2275
fixed the types. don't forget to donate if you find this lib useful! |
GridStack.setupDragIn not working inside the web component
Tried Gridstack inside the Lit web component, and it's working fine, but the scenario like dragging in the element from the sidebar (https://gridstackjs.com/demo/static.html) does not work inside shadow root.
Environment
version of gridstack.js - ^7.2.3
which browser/OS - all
Steps to reproduce
GridStack.setupDragIn method need to be called inside the web component(ShadowRoot), The following link has a working demo to reproduce the same inside Lit.
https://stackblitz.com/edit/vitest-dev-vitest-bzx77k?file=src/designer.ts
Expected behavior
Currently, inside setupDragInMethod, we are calling Utils.getElements,
gridstack.js/src/gridstack.ts
Line 1679 in d99a9f5
Utils.getElements internally using document.querySelectorAll, I think to work inside the shadow root, we need to query inside the parent element or give an argument to the method where we should look in the shadow root scenario...
gridstack.js/src/utils.ts
Line 59 in d99a9f5
The text was updated successfully, but these errors were encountered: