Shopify / draggable

The JavaScript Drag & Drop library your grandparents warned you about.
https://shopify.github.io/draggable
MIT License
17.89k stars 1.1k forks source link

ShadowDOM support #153

Open ernsheong opened 6 years ago

ernsheong commented 6 years ago

I'm trying out Draggable in a shadow DOM, and it doesn't seem to work. A glance at the codebase reveals use of document.addEventListener, etc. which prevents it from working in shadow DOM, presumably because events from inner elements are not able to cross the shadowDOM boundary to the document top level.

tsov commented 6 years ago

Interesting idea! How about we add an option to specify a host element? If the host element is not specified we'll fallback on document ?

Example

new Draggable(containers, {
  host: shadowRoot,
});
ernsheong commented 6 years ago

Thanks for the response!

Yes, that sounds like the way to go about this, and it looks like the strategy employed by https://github.com/RubaXa/Sortable/blob/master/Sortable.js as well.

tsov commented 6 years ago

No problem 👍

We'll add it to the next release! I'll add a mention on the PR for some 👀

Thanks for bringing this up!

tsov commented 6 years ago

@ernsheong 👋 if you are interested in following ShadowDOM support follow either:

We are currently working on supporting iframes, which ties in nicely with ShadowDOM, as we will support the DocumentOrShadowRoot interface

ernsheong commented 6 years ago

@tsov thank you for the effort. This is nice to see! Not many libraries are as forward thinking, and many are reluctant to add that complexity. Kudos for that 👍

ralcar commented 6 years ago

Does ShadowDOM work yet or is this still work in progress? Would really like to try this in Polymer 3

tsov commented 6 years ago

@ralcar ShadowDOM support is still on the way! Both @beefchimi and I are/were on vacation in-between, but we are fully dedicated to support ShadowDOM all the way.

ralcar commented 6 years ago

@tsov Any news on this? =(

MaximKipot commented 6 years ago

@tsov Is this awesome feature still on the way?

JosefJezek commented 6 years ago

@tsov Please put it in a high priority :up:

ralcar commented 6 years ago

Yes please do! :D

aletorrado commented 5 years ago

Any update about this feature?

TimeBandit commented 5 years ago

I believe this is affecting my end-to-end. I am running tests inside Cypress.js which uses iframes to show your tests running. We are using draggable to simulate a drag and drop. This error message is seen when the mouseup event is triggered.

Uncaught TypeError: Failed to execute 'elementFromPoint' on 'Document': The provided double value is non-finite.

Please comment or provide a workaround. I think the issue is line 173

I should add I am running Ubuntu.

minicatsCB commented 10 months ago

Hello, hope you are all doing well. I just wanted to check in with you and see how the issue is going. I know there might be other demanding tasks, so I appreciate your work and dedication.

I see there are at least two PR's:

I'm not very familiar with the technical details, but I'm curious to hear about the progress and challenges. I want to understand what you're doing and how it works. Is there anything I can do to help?

Thanks!