Update cancel check to be shadowRoot compatible
This proposal is made to ensure if the event should be canceled if the first element in the composedPath (or the event.target as fallback) matches with the options.cancel selector
This behaviour happens when we're using shadowRoot and we're trying to cancel the mousedown event when it starts from an element within the shadowRoot.
The committers listed above are authorized under a signed CLA.
- :white_check_mark: login: malarahfelipe / name: Felipe Mateus Malara (3a1b590817aaa692f53ae1d8354d8d3485594c23)
@mgol What do you think about this? @malarahfelipe Can you try fixing the tests?
@fnagel sure thing 👍
Fixed @fnagel.
Surely this is a specific case scenario, where I'm using Sortable with Web Components, but this may come in hand when Web Components get more and more popular
As answered in the question below, the purpose of using event.composedPath() is to get specifically which element triggered the event within the Web-Component (container).

@malarahfelipe Tests still fail :-(
Sorry, missed the grunt test workflow I believe is fine now 👍 @fnagel
Still failing.
Surely, the lint got me again sorry, now I was able to run them locally and seems fine

Thanks
It'd be good to see what case currently doesn't work on a live test case. This PR needs tests anyway, preparing an isolated test case may be a good starting point in creating one.
As it stands, I don't have a specific opinion as I don't understand what exactly this PR is trying to fix.
@mgol Thanks for the feedback! I must confess I'm not really familiar with Web Components so I hoped for your input :-)
Maybe @dmethvin can help us out here?
@malarahfelipe Thanks for fixing the tests! Can you give some some more insights?
Thanks for the feedback on this guys
Sure @fnagel I'll prepare two codepens one using web-components and other not to better explain the differences on this
Okay, after long time 😅 I've set up three simple codepens to better explain the proposed solution
- JqueryUI.Sortable without ShadowRoot https://codepen.io/malarahfelipe/pen/QWmEoVz
- JqueryUI.Sortable with ShadowRoot ❌https://codepen.io/malarahfelipe/pen/XWEjpWo
- JqueryUI.Sortable with ShadowRoot ✅ https://codepen.io/malarahfelipe/pen/eYMBYGb
Also I've record a <1min loom video just dragging things around so you can see the output in the html / console
https://www.loom.com/share/a2c4f95d5eae4589967a00041bcb7307
Thank you