-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Supporting use in shadow roots #2319
base: master
Are you sure you want to change the base?
Conversation
This commit addresses atlassian#1659 and allows use of RBD inside shadow roots e.g. in Web Components. It does not cover drag&drop between different shadow roots. The following changes were needed: - To find the event target nested inside a shadow root we use composedPath instead of event.target (since event.target points just to the shadow root host). - To find draggables/droppablesInstead we use query selectors on root node of the event source instead of the document. This is encapsulated in a new central place (src/view/get-elements/query-elements.js). - Shadow roots isolate stylesheets, means global styles do not bleed into the shadow root. Built-in styles need to be added to the shadow root. This can be done by allows consumers to specify the DOM location as a stylesInsertionPoint prop on the DragDropContext. Similar approach is taken by JSS (see https://cssinjs.org/jss-api?v=v10.6.0#setup-jss-instance).
hey @spielzeugland, we actually do have a record of your signed CLA. cc @alexreardon feel free to disregard the CLA check and merge the PR whenever you're ready 😃 |
@spielzeugland update: it's been fixed 😄 |
When it is expected that this PR will be merged? |
@umarzec I contacted @danieldelcore already but did not get a reply. This project feels quite inactive (not to say dead) somehow. |
Any news about a merge ? :) @spielzeugland |
@briva unfortunately I don't think this will ever be merged. Quote from README.md:
I read it like "the library is dead". Someone might create a fork. However I already moved ahead working on another project. |
Yes, that's sad this library is really great. I already forked your fork my my personal usage 😄. If someone create a new fork in order to keep it update and merge PR, it will be awesome. |
Hey guys, is there an ETA on when this can get merged? We started using Shadow roots for our micro-frontends and all of our DnD behavior broke. |
Hi @luijar, micro frontends are a perfect example of requiring support for shadow-roots. I recommend to team up with all the other interested people and create a community fork as proposed in the issue. |
@spielzeugland thanks, your PR was lifesaving! 🤩 |
@spielzeugland Thank you for your awesome job !! How can I add your package ? I tried But it's adding the repo to my
@johnnyfekete if you have any tips too please let me know 🙏 |
Sure, you need to go to the folder, run |
thank you @johnnyfekete !! 🙏 I wanted to avoid that manually build but it seems like a Nonetheless, I tried your solution with React 18 and I encountered this issue below
Have you tested it with React 18? I saw that there have been some updates on the current package since this Shadow DOM pull I also tried to pull the latest Thank you again for your help 🙏 |
@sbahir I did it differently: created a fork, and worked on it. So it's not in the original project's node_modules folder, but a standalone version. Then, you can use refer to that forked version in your package.json. Unfortunately I don't know any more than this, so hope this helps |
@johnnyfekete thanks again for your help on this topic! I found the reason why it was complaining about the After I run The solution is to build the dist and push it to npm. Then run it works brilliantly now 🥳 |
This commit addresses #1659 and allows use of RBD inside shadow roots e.g. in
Web Components. It does not cover drag&drop between different shadow roots.
The following changes were needed:
instead of event.target (since event.target points just to the shadow root
host).
the event source instead of the document. This is encapsulated in a new
central place (src/view/get-elements/query-elements.js).
shadow root. Built-in styles need to be added to the shadow root. This can be
done by allows consumers to specify the DOM location as a
stylesInsertionPoint prop on the DragDropContext. Similar approach is taken
by JSS (see https://cssinjs.org/jss-api?v=v10.6.0#setup-jss-instance).