Closed Bug 1770671 Opened 2 years ago Closed 2 years ago

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)

Desktop
Windows
defect

Tracking

()

RESOLVED INVALID

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 is 0. It's 2 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?

Flags: needinfo?(krosylight)

Well, it seems it's always buttons: 0 regardless of the pointer pref, interestingly 🤔

Flags: needinfo?(krosylight)

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.

Severity: -- → S3
Component: DOM: UI Events & Focus Handling → DOM: Events
Priority: -- → P5
Hardware: Unspecified → Desktop
Summary: "contextmenu" event has buttons property set to 0 on Windows → MouseEvent.buttons of "contextmenu" event does not contain a flag of a button which is caused by the event
QA Whiteboard: [qa-regression-triage]

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.

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.

Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.