Fix shadow DOM: Change target for event
Fix #2096 . I changed target for event. It works for me.
I'll look into it, this may potentially cause the event to not fire in older mobile browsers. If you have a test case with the Shadow DOM (from #2096) - please provide a link or source.
The issue with your solution is that if a pointer is released outside of the document - the pointerup/cancel event is not fired.
This can be solved via setPointerCapture, however, it modifies event.target and makes it always the initial element, which messes up click/tap/doubletap event handling.
A similar thing happens if legacy mouse and touch events are used (mouseup, touchend etc), however, they don't have an alternative to setPointerCapture. So using setPointerCapture would also mean dropping full support for non-pointer events.
A possible solution might be to listen for pointerleave and cancel all gestures if it is triggered, but it needs testing.
I'm not sure yet what's the best approach to solve this yet, just posting the findings.
I made a demo repo reproducing the problem: https://github.com/AlyonaCh/ShadowDOMExample https://alyonach.github.io/ShadowDOMExample/