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
Select2 inside ShadowRoot Broke In 4.0.11 #5682
Comments
Probably going to switch this to if ($.contains(document.body, $offsetParent[0]) || $offsetParent[0].isConnected) {
parentOffset = $offsetParent.offset();
} Just to handle IE/Edge/older browsers when they aren't using the shadow DOM (because let's be honest, they won't be using the shadow DOM if they're old enough to not support |
I have made the change locally, looking into how to get proper test coverage for this |
Fix support for the Shadow DOM when calculating offsets
I am still not able to get it working inside the shadowDOM. I am trying to use it inside an angular element. It gives me an error: Please add Select2 library (js file) to the project. I am using view encapsulation in this. I do not know how to use dropdownParent properly, so have not tried that |
I have it working with a dropdownParent referencing an element in the shadow dom, if that helps. |
Can you give me a reference as to how exactly to do it? |
Hi, issue still persists for multiple shadow DOM subtrees having select2 elements. I have a custom element, and i initialize select2 for elements inside shadow DOM, in connectedCallback. And when i add second, third and so on custom elements, all select2 forms nested in existing custom elements are become broken. |
#5584 breaks the usage of Select2 inside a ShadowRoot, because
$.contains()
returns false, even though the Node is actually connected to the document.I'd propose changing the following code:
To this:
The text was updated successfully, but these errors were encountered: