auto-animate icon indicating copy to clipboard operation
auto-animate copied to clipboard

isMounted method is incompatible with Shadow DOM

Open e111077 opened this issue 2 years ago • 2 comments

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

e111077 avatar Jun 21 '22 03:06 e111077

Thanks!

justin-schroeder avatar Jun 21 '22 11:06 justin-schroeder

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.

e111077 avatar Oct 13 '22 17:10 e111077