Open Bug 1961462 Opened 25 days ago Updated 23 days ago

Unexpected `click` event when using `setPointerCapture` on an element and move pointer to another element before releasing click (dragging)

Categories

(Core :: DOM: Events, defect)

Firefox 137
defect

Tracking

()

Tracking Status
firefox-esr115 --- wontfix
firefox-esr128 --- wontfix
firefox137 --- wontfix
firefox138 --- wontfix
firefox139 --- wontfix

People

(Reporter: lcz970, Unassigned)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 file)

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 )

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.

Component: Untriaged → DOM: Events
Product: Firefox → Core
Status: UNCONFIRMED → NEW
Ever confirmed: true

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.

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.

Severity: -- → S3
Depends on: 1885232
Flags: needinfo?(smaug)
OS: Unspecified → All
Hardware: Unspecified → All
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: