draggable icon indicating copy to clipboard operation
draggable copied to clipboard

ShadowDOM support

Open ernsheong opened this issue 7 years ago • 14 comments

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.

ernsheong avatar Feb 16 '18 07:02 ernsheong

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,
});

tsov avatar Mar 05 '18 15:03 tsov

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.

ernsheong avatar Mar 05 '18 15:03 ernsheong

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 avatar Mar 05 '18 15:03 tsov

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

  • The WIP PR: https://github.com/Shopify/draggable/pull/202
  • Or this related issue: https://github.com/Shopify/draggable/issues/189

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

tsov avatar Apr 05 '18 00:04 tsov

@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 👍

ernsheong avatar Apr 05 '18 00:04 ernsheong

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

ralcar avatar May 31 '18 00:05 ralcar

@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.

tsov avatar May 31 '18 14:05 tsov

@tsov Any news on this? =(

ralcar avatar Jul 13 '18 08:07 ralcar

@tsov Is this awesome feature still on the way?

MaximKipot avatar Jul 26 '18 10:07 MaximKipot

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

JosefJezek avatar Aug 16 '18 11:08 JosefJezek

Yes please do! :D

ralcar avatar Aug 18 '18 15:08 ralcar

Any update about this feature?

aletorrado avatar Dec 19 '18 23:12 aletorrado

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.

TimeBandit avatar Aug 14 '19 16:08 TimeBandit

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!

minicatsCB avatar Oct 30 '23 13:10 minicatsCB