Unexpected `click` event when using `setPointerCapture` on an element and move pointer to another element before releasing click (dragging)
Categories
(Core :: DOM: Events, defect)
Tracking
()
People
(Reporter: lcz970, Unassigned)
References
(Regression)
Details
(Keywords: regression)
Attachments
(1 file)
702 bytes,
text/html
|
Details |
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:137.0) Gecko/20100101 Firefox/137.0
Steps to reproduce:
Using attached html page:
- Click and hold mouse on blue square
- Move pointer to green square without releasing
- Release the mouse button
Actual results:
An click
event is fired on green square
Expected results:
Similar discussion: https://github.com/w3c/pointerevents/issues/75
Current version of chrome (version 135) does not fire click
event on green square.
A workaround for this issue I found:
element.addEventListener('pointerdown', e => {
e.target.setPointerCapture(e.pointerId);
// ...
window.addEventListener('click', stopGlobalClick, { capture: true, once: true });
}
function stopGlobalClick(e) {
e.stopPropagation();
}
Workaround assumes click
event is not needed for current pointer event cycle, while it is often true for drag & drop actions, it will break functions for element serve both click and drag actions.
In chrome, click is fired on element which called setPointerEvent
, regardless of where the orginal pointerdown
is triggered. (See https://output.jsbin.com/zuwiwep )
Comment 2•25 days ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::DOM: Events' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
![]() |
||
Comment 3•25 days ago
|
||
Regression window:
https://hg-edge.mozilla.org/integration/mozilla-inbound/pushloghtml?fromchange=f6eebcc14c22762f521fb567a9588963b8720592&tochange=61570c16c2d564c24fab36713fb169c4144453e9
Susprect:Bug 1089326
![]() |
||
Updated•25 days ago
|
Comment 4•25 days ago
|
||
Set release status flags based on info from the regressing bug 1089326
:smaug, since you are the author of the regressor, bug 1089326, could you take a look? Also, could you set the severity field?
For more information, please visit BugBot documentation.
Updated•23 days ago
|
Comment 5•23 days ago
|
||
I'm trying to fix bug 1885232 in the next release because this behavior change is risker than usual. Therefore, I'd like to fix it in very early state of a cycle.
Description
•