MouseEvent.buttons of "contextmenu" event does not contain a flag of a button which is caused by the event
Categories
(Core :: DOM: Events, defect, P5)
Tracking
()
People
(Reporter: darktrojan, Unassigned)
References
Details
STR:
- Add an event listener on any page that logs
contextmenu
events to the console. - Right-click on the page.
- Observe that on Windows, the
buttons
property is0
. It's2
on other platforms.
I can see this in Firefox 100 and on trunk. It may be older, I didn't go back further.
It seems that the patch for bug 1031362 touched around the assignee of WidgetMouseEventBase::mButtons
last time which overwrites the old value which is set by the legacy API with this
https://searchfox.org/mozilla-central/diff/f60994b515f78be64b1f83479ad9f2425dd4c25b/widget/windows/nsWindow.cpp#4223
However if it comes from the legacy path, it won't be overwritten. So it seems that this depends on whether the pointer event path is enabled or disabled.
saschanaz: Do you have any idea?
Comment 2•2 years ago
|
||
Well, it seems it's always buttons: 0
regardless of the pointer pref, interestingly 🤔
Thanks. And this is same behavior as Blink, and both Gecko and Blink let web apps of the other pressing buttons. I guess that Windows does not set right button press flag if it's handled as an event to open context menu.
For now, we don't have a motivation to fix this bug because of compatible with Chrome.
Updated•2 years ago
|
Comment 4•2 years ago
•
|
||
Oh, I forgot to submit this comment:
It's also 0 in Chrome on mouseup/pointerup/click/contextmenu since no button is being pushed at that point. And it's not a regression, it's been like this for quite a lot of years. (I can see the same in 2017 build.)
WebKit seemingly does the same as Gecko does per what I'm seeing on Gnome Web, could you check what other browsers do on macOS perhaps?
So, I guess maybe check what other browsers on Linux/macOS do?
Ah, it might be caused by the difference whether context menu should be opened at mousedown
or mouseup
. On Windows, context menu opens when I release the mouse button.
Comment 6•2 years ago
|
||
Ah, in that case I think we can safely close this as wontfix.
Yeah, Chrome also opens context menu at releasing mouse button on Windows. So, this is invalid at least on Windows.
Perhaps, the spec should mention about this platform dependency, though.
Description
•