In Windows, the contextmenu event fires with mouse up. So usually my addon has a flow like this:
mousedown -> mouse gesture start
mousemove -> mouse moved = true
contextmenu -> if mouse moved then event.preventDefault()
However, in OSX and possibly Linux the contextmenu event fires with mouse down. The problem is that I don’t know if the user is starting a gesture at mouse down, so I cannot event.preventDefault() the context menu at that time.
One solution is to force OSX users to use a modifier key when performing a gesture, but that feels counterproductive. (Its a mouse gestures addon, you shouldn’t have to go to the keyboard to use it.)
Ideally, I’d like an ability to programmatically open the context menu. That way I can use event.preventDefault(), see if the user performed a gesture or not, then open the context menu if necessary.
Very interesting, I tested it with Windows 10, Ubuntu 16.04 (cinnamon), Linux Mint (VM) and macOS 10.12:
MacOS:
“normal” behavour:
down: open at current position
up: invoke if hovering entry, close if outside of the menu
Firefox:
down: open at current position
up: invoke if hovering entry, nothing otherwise
Thunderbird:
down: open at current position
up: nothing ever
Linux: same as macOS, but probably depends on the window server. Thunderbird not tested
Windows:
down: nothing
drag: sometimes selects or drags stuff
up: open at current position
As to what you can do:
Firefox on non-Windows systems behaves similar, to normal system apps, but not exactly the same anyway. You could request a Firefox-global preference to switch to the windows behavior. Then you would need to ask the user to toggle that preference (or it would need to be exposed to extensions).
If you got manual control to open the menu, you would effectively implement the windows behavior anyway, so I don’t think that’s the way to go.
As far as my tests go (VM with mouse foe macOS, Notebook with touchpad and mouse foe Linux), neither macOS nor Linux do anything when you drag with the mouse wheel. You could use that instead.
The mouse forward/back buttons may be an option too (if present). They trigger their action on button down, but that should be catchable and you can manually invoke it on mouse up if you want to.
Oh, and booth left and right button could work too. On my linux system, Firefox doesn’t do anything when you press booth at once. On macOs, the user would need to press the left button first, because you need to prevent the menu from opening when the right button is pressed.
As it does on Windows. I probably didn’t get that due to the bad VM integration of macOS (or due to my bad setup of the VM, who knows …).
Is Bugzilla the correct place to request a feature or WebExtensions API?
It is at least one place. Sooner or later a bug is filed for every new feature. Response times on Bugzilla are almost as bad as the current review times,