Closed
Bug 1912809
Opened 1 year ago
Closed 1 year ago
setPointerCapture() causes an onclick event for the wrong element (INVALID)
Categories
(Firefox :: Untriaged, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: octogonz, Unassigned)
Details
Attachments
(1 file)
|
1.76 KB,
text/html
|
Details |
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0
Steps to reproduce:
A complete repro file is attached. The problem occurs when a control is using setPointerCapture() to act like a button, for example this div:
HTML:
<div
class="button"
onmousedown="buttonDown(event)"
onmouseup="buttonUp(event)"
>
MOUSEDOWN HERE
</div>
JavaScript:
function buttonDown(event) {
// The repro works even without this line:
event.preventDefault();
event.currentTarget.setPointerCapture(event.pointerId);
}
function buttonUp(event) {
// The repro works even without this line:
event.currentTarget.releasePointerCapture(event.pointerId);
}
Steps:
- Click on this div, holding the mouse down.
- Drag the mouse over some unrelated element on the page, let's call it the mousedown element.
- Release the mouse over the target element. We'll call that the mouseup element.
Actual results:
In Chrome, the mouseup element does not receive any mouse events, because the mouse is captured.
Expected results:
In Firefox, the mouseup element incorrectly receives an "onclick" event (but not mousedown or mouseup). If it is an <a> tag, Firefox will actually navigate to its href URL.
| Reporter | ||
Comment 1•1 year ago
|
||
A better wording of the steps:
Steps:
- Click on this "mousedown" div, holding the mouse down.
- Drag the mouse over some unrelated element on the page. Let's call that the "mouseup" element.
- Release the mouse over the "mouseup" element.
| Reporter | ||
Comment 2•1 year ago
|
||
Let me resubmit this. Bugzilla doesn't allow me to edit what I wrote.
Status: UNCONFIRMED → RESOLVED
Closed: 1 year ago
Resolution: --- → INVALID
| Reporter | ||
Updated•1 year ago
|
Summary: setPointerCapture() causes an onclick event for the wrong element → setPointerCapture() causes an onclick event for the wrong element (INVALID)
You need to log in
before you can comment on or make changes to this bug.
Description
•