I麓m using rbd in an app that is wrapped by a web component which uses the shadow DOM.
Drag and drop is not possible and in the browser console I get the error message, that drag handle could not be found. Is there a way we can get this working?
Use rbd in the shadow DOM.
React are you using?
16.12.0
react-beautiful-dnd are you running?12.1.1
Chrome 78, Firefox 71
We try to find the drag handle using a selector. If the drag handle is within a shadow dom, then my understanding is that we cannot query what is in the shadow DOM from the outside. Does that sound right?
I could not find a way to do it with a selector. It looks like you need to find the shadow root and then you can query from there. We'll need to think through what is the best way to do this. Ideally, we do not query every shadow root.
Some initial thinking:
findDragHandleIdByEvent override where consumers can do things like query shadow roots@alexreardon thank you!
We try to find the drag handle using a selector. If the drag handle is within a shadow dom, then my understanding is that we cannot query what is in the shadow DOM from the outside. Does that sound right?
Sounds right to me and I think exactly that麓s the problem.
- ask consumers to put a data attribute on the shadow roots they do want us to query
I tried to hack a little solution for this one by attaching the data-shadow="true" attribute to the custom element. Afterwards it is possible to find the drag handle by e.g. using
document.querySelector('[data-shadow="true"]').shadowRoot.querySelectorAll('[data-rbd-drag-handle-context-id="0"]').
However, it麓s still not possible to move the items in the list. Is it possible, that we also have to fix something with events in the shadow root?
Any updates on this? I am also having the same problem and would love the afore-mentioned feature of having access to the shadow dom. @alexreardon
I'm facing the same issue as @alexreardon the only thing left is to make the items move.
I would love to use react-beautful-dnd but can't because of this, it wasn't mentioned in the documentation either
I would also love to use this solution but have been hamstrung by this issues. We are building micro-frontend apps and have to use web-component with shadowDOM for isolation. Is there any roadmap from RBD for solving this issue?
Most helpful comment
Any updates on this? I am also having the same problem and would love the afore-mentioned feature of having access to the shadow dom. @alexreardon