- From: Robert Flack via GitHub <sysbot+gh@w3.org>
- Date: Fri, 09 Jul 2021 17:44:33 +0000
- To: public-pointer-events@w3.org
This bug gets into the more complicated area of releasing capture. The case in the bug is clicking on descendant in the following: ```html <div id="a"> <div id="b"></div> </div> <script> a.addEventListener('pointerdown', (e) => { a.setPointerCapture(e.pointerId); }); a.addEventListener('pointerup', (e) => { a.releasePointerCapture(e.pointerId); }); b.addEventListener('click', (e) => { console.log('clicked'); }); </script> ``` The capture is released before the click event, which raises questions about whether click should no longer be captured. In this particular case, it shouldn't matter since I'd argue that the pointerup was captured so the click target should still be the common ancestor of the captured up event (i.e. #a) and the down event (i.e. #b), so we would target the click at #a and not fire the click event. However, what if we set pointer capture on a different element? ```html <body> <div id="a"> <div id="b"> </div> </div> <div id="c"></div> </body> <script> a.addEventListener('pointerdown', (e) => { c.setPointerCapture(e.pointerId); }); c.addEventListener('pointerup', (e) => { c.releasePointerCapture(e.pointerId); }); c.addEventListener('click', (e) => { console.log('clicked'); }); </script> ``` Do we consider the captured pointerup to have also captured the corresponding click even though it hasn't been dispatched yet? Or would we target the click at the common ancestor of the down event target (#b) and up event target (#c), i.e. the body. -- GitHub Notification of comment by flackr Please view or discuss this issue at https://github.com/w3c/pointerevents/issues/356#issuecomment-877352276 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Friday, 9 July 2021 17:44:44 UTC