In native context menus, report the mouse button which was used to click the menu item, to support a WebExtension API
Categories
(Core :: Widget: Cocoa, defect)
Tracking
()
People
(Reporter: mstange, Assigned: mstange)
References
Details
(Whiteboard: [proton-uplift])
Attachments
(1 file)
Our WebExtension menu items have the ability to detect the mouse button that a context menu item was clicked with: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/menus/OnClickData
This was added in bug 1469148 and is only supported in Firefox.
Do we want to support this capability on macOS with native menus? On macOS, having a menu item behave differently depending on what mouse button it was clicked with is very unexpected... but not impossible.
So I think we have two choices here:
- Choose not to support it (always report button 0) and disable the test
browser_ext_menus_capture_secondary_click.js
if native menus are used. - Or implement support for it.
Thoughts?
Comment 1•4 years ago
|
||
It should ideally be supported, for API consistency across platforms.
Do you have any idea about what it entails to support this functionality?
Test is being disabled (well, changed to fake events that does not match reality) for now in https://phabricator.services.mozilla.com/D111901
Comment 2•4 years ago
|
||
This is also used in the search context menu item, shown when in-content text is selected. A middle click does the search in a background tab. This is causing browser/components/search/test/browser/browser_contextmenu_whereToOpenLink.js
to fail.
Assignee | ||
Comment 3•4 years ago
|
||
(In reply to Rob Wu [:robwu] from comment #1)
It should ideally be supported, for API consistency across platforms.
Given that it is indeed possible, I can't really argue with that. It's just a bit weird / doesn't conform to macOS platform expectations. But I suppose the "safe" thing to do here is to keep existing functionality working and then have this discussion at some other point in the future.
Do you have any idea about what it entails to support this functionality?
It's not hard, the information is in NSApp.currentEvent.buttonNumber
and we just need to forward it to the right place.
Assignee | ||
Comment 4•4 years ago
|
||
Depends on D111980
Assignee | ||
Comment 5•4 years ago
|
||
(In reply to Markus Stange [:mstange] from comment #3)
It's not hard, the information is in
NSApp.currentEvent.buttonNumber
and we just need to forward it to the right place.
It turns out there was a bit of a challenge here, because the current implementation in ext-menus.js gets the button from the click event, and we don't have a click event in native menus. I filed bug 1704948 to find a solution for this.
Comment 7•4 years ago
|
||
bugherder |
Comment 8•4 years ago
|
||
bugherder uplift |
Updated•4 years ago
|
Updated•3 years ago
|
Description
•