- From: Masayuki Nakano via GitHub <sysbot+gh@w3.org>
- Date: Thu, 02 Nov 2023 03:20:50 +0000
- To: public-pointer-events@w3.org
masayuki-nakano has just created a new issue for https://github.com/w3c/pointerevents: == Clarify `mousedown` event target if the preceding `pointerdown` event listener removes the target == https://github.com/web-platform-tests/interop/issues/380#issuecomment-1787398235 Spinning out from the above issue. Currently, only Chrome dispatches a `mousedown` event to parent element when a `pointerdown` event listener removed the event target. **I** think that Chrome's behavior may lead odd behavior because user tried to click under the pointer, not its parent (or ancestor). However, the `mousedown` may cause running event listeners of them. This must be trouble if the element is not visually in the parent or ancestor element. On the other hand, Safari dispatches a `mousedown` event on the removed child element, but I think that this is not required. In my understanding, `mousedown` event should not be fired if the preceding `pointerdown` event removed the target. And I think this can be applied to other sets of a pointer event and a fallback mouse event. I also found one odd thing of Chrome's behavior. https://jsfiddle.net/d_toybox/m18jpnae/ ```js e.addEventListener("pointerdown", event => { event.target.remove(); }); addEventListener("click", () => alert("clicked")); ``` https://jsfiddle.net/d_toybox/m18jpnae/1/ ```js e.addEventListener("mousedown", event => { event.target.remove(); }); addEventListener("click", () => alert("clicked")); ``` In the first case, Chrome dispatches `mousedown` on the parent, and then, `mouseup` on the parent too. Therefore, `click` event should be fired from UI Events point of view. However, Chrome does not dispatch it. I guess Chrome fixes the candidate of the `click` event at dispatching `pointerdown` and the removal of the event target causes stopping dispatching it. @mustaqahmed, @smaug----, @garykac Please view or discuss this issue at https://github.com/w3c/pointerevents/issues/492 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Thursday, 2 November 2023 03:20:52 UTC