Open Bug 1791192 Opened 2 years ago Updated 2 years ago

pointerout event with mouse button held reports button == 0 when moving out of window

Categories

(Core :: DOM: Events, defect)

Firefox 105
Desktop
macOS
defect

Tracking

()

Webcompat Priority P3

People

(Reporter: ejfr76, Unassigned)

Details

(Keywords: parity-chrome)

Steps to reproduce:

I added an event listener to the window to listen for 'pointerout'. I move click the button and hold it down while I move out of the browser window.

Can be tested here:
https://jsfiddle.net/h5ovjwc2/

Actual results:

The event object sent to my callback function has the properties button == 0 and buttons ==0, even though the left mouse button was pressed and held.

Expected results:

I would expect the event object to have the properties buttons = 1 and button = -1. This problem seems unique to Firefox, other browsers I tested report the buttons being held, properly. Tested on Firefox Developer Edition 105.0b9 (64-bit) on MacOS Monterey 12.6

OS: Unspecified → macOS
Hardware: Unspecified → Desktop

The Bugbug bot thinks this bug should belong to the 'Core::DOM: UI Events & Focus Handling' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → DOM: UI Events & Focus Handling
Product: Firefox → Core

(In reply to ejfr76 from comment #0)

Can be tested here:
https://jsfiddle.net/h5ovjwc2/

The event listener listens to pointerleave, but you reported this bug as a bug of pointerout. Is the test case wrong (i.e., pointerout is what you reported as the text)?

Flags: needinfo?(ejfr76)

Ah, yes, sorry for the mess up. I mistakenly pasted the wrong fiddle address. Here is the correct one:
https://jsfiddle.net/efrancis76/oj2rLnd9/

I had tried both pointerout and pointerleave. In my real life example the same error showed for both events, but I could not get it to show properly in the fiddle to demonstrate, so I only reported 'pointerout' for now, until I figure out how to reproduce the 'pointerleave' bug in a fiddle.

Flags: needinfo?(ejfr76)

Thank you.

About the buttons, releasing the mouse button cancels the implicit capture, and causes pointerout event. Therefore, it seems that buttons should be 0 and Chrome also works as so on Windows.

About the button, it indicates the transition of the mouse button state by the event. Therefore, it seems that button should be -1.

Gecko just copies button and buttons value of the source mouse event even though the button value meaning is different:
https://searchfox.org/mozilla-central/rev/b1e5f2c7c96be36974262551978d54f457db2cae/dom/events/EventStateManager.cpp#4420-4421

Edgar, could you take a look?

Severity: -- → S3
Status: UNCONFIRMED → NEW
Webcompat Priority: --- → ?
Component: DOM: UI Events & Focus Handling → DOM: Events
Ever confirmed: true
Keywords: parity-chrome

After reading your explanation, I think there is a misunderstanding here: I do, in fact, never release the mousebutton. I keep the button pressed while moving outside of the window and I still keep the button pressed. The pointerout event is triggered as soon as I move out of the browser but it fails to inform me, that the mouse button was in fact still being held at that moment.

This detail differs from Safari and Chrome who both let me know the mouse button was still down when the cursor left the window. Edge seems to work still differently, by never triggering the pointerout event at all unless the mouse button is released.

I think this is a dupe of something we know, ni? myself to find that other bug.

Flags: needinfo?(dschubert)

Hm, I couldn't find the bug, so maybe I had something different in my memory.

Webcompat Priority: ? → P3
Flags: needinfo?(dschubert)
You need to log in before you can comment on or make changes to this bug.