- From: Dominic Farolino <notifications@github.com>
- Date: Wed, 15 May 2024 20:10:40 -0700
- To: whatwg/dom <dom@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/dom/issues/1255/2113931926@github.com>
> This is because when swapping two children one has to make a choice which one to remove from the DOM and then reinsert. So if we always remove the one on the right (as React does), pointer capture will be lost only when moving to the left. > I guess that for this special case we could actually check if the element has pointer capture active and in that case do the swap the other way around (insertBefore(prev, next.nextSibling) instead of insertBefore(next, prev)), but this is not something React does. Yep, I had made the same exact code change to your codepen on my own to experiment with. So yeah, while this sort of thing can be worked around by moving _different_ nodes around the DOM with the classic APIs, encouraging this is bad because it just pushes the side effects of state-resetting to other nodes that are further away from the original interaction It looks like this is all captured in https://github.com/whatwg/dom/issues/1270#:~:text=Pointer%20event%20state%20reset%3A%20see%20here, which points to the relevant parts of the pointer events spec ([example](https://w3c.github.io/pointerevents/#dfn-implicitly-release-the-pointer-capture)), so I think we're all on track for this! -- Reply to this email directly or view it on GitHub: https://github.com/whatwg/dom/issues/1255#issuecomment-2113931926 You are receiving this because you are subscribed to this thread. Message ID: <whatwg/dom/issues/1255/2113931926@github.com>
Received on Thursday, 16 May 2024 03:10:44 UTC