-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
fix: set the target as the host element when target contains a shadowRoot #2347
Conversation
…Root. SortableJS#2346
I love you. Thanks for the fix. |
**Related Issue:** #8728 ## Summary - Fixes dragging when on a mobile device. - Sortablejs uses fallback code instead of native drag and drop on mobile devices. - Patches `sortablejs` dependency until the fix for the issue is installed and released. SortableJS/Sortable#2346 - Adds and uses the dependency `patch-package` to handle patching the dependency. - Applies the changes listed here: SortableJS/Sortable#2347 --------- Co-authored-by: JC Franco <jfranco@esri.com>
**Related Issue:** #8728 ## Summary - Fixes dragging when on a mobile device. - Sortablejs uses fallback code instead of native drag and drop on mobile devices. - Patches `sortablejs` dependency until the fix for the issue is installed and released. SortableJS/Sortable#2346 - Adds and uses the dependency `patch-package` to handle patching the dependency. - Applies the changes listed here: SortableJS/Sortable#2347 --------- Co-authored-by: JC Franco <jfranco@esri.com>
@owen-m1 Let me know if there's anything I can do to get this one moving. Thanks |
@driskull Thank you for the fix, but unfortunately this code defeats the purpose of the loop for going within shadow DOMs to find the target, since it immediately jumps out of the shadowDOM thus breaking the loop. What would be better is if we move the fix to later on in the function, when we are trying to detect the nearest Sortable to the target, and allow that loop to exit the shadowDOM to traverse parents outside of it. Specifically your code could be moved to line 788: while (parent = (parent.parentNode || parent.host)); In fact, we have a util function to make this simpler: while (parent = getParentOrHost(parent)); Haven't tested this but I believe it should fix the issue and still support targets within a shadowDOM, please let me know if that's not the case |
uses getParentOrHost utility and moves logic to appropriate place
Thanks @owen-m1, that suggestion works and makes perfect sense. I've updated the PR to reflect the changes. |
**Related Issue:** #9521 ## Summary - patch sortablejs with the correct update to fix dragging shadow elements on mobile devices - SortableJS/Sortable#2347 SortableJS/Sortable#2346
Fix for sorting elements that contain web components
See #2346 for explanation and code samples of the issue.
When sortable elements contain web components with shadowRoot, and forceFallback is enabled, swapping elements is not working correctly.
DOM Example: