auto-animate
auto-animate copied to clipboard
isMounted method is incompatible with Shadow DOM
Description
The method for calculating isMounted
doesn't seem to work in shadow DOM, because document.contains()
will return false for anything inside of shadow DOM. Consider using Node.isConnected
.
Reproduction
link to the svelte example written in Lit
steps:
- add or remove a chip
- observe that the sibling elements after do not animate but flash into position
debugging steps:
- open dev tools
- find console log of
autoAnimate
- click on function to open source
- add debugger to the mutation sibling lines
- add a child
- observe mutation previous sibling
Thanks!
I've pinned down the issue. I've worked on a fix (just add || el.isConnected
to the line defining isMounted
), but I'm having trouble running the tests to verify I haven't broken anything else.