Right Click - context menu not opening inside webextension

Hi There,

I have developed a webextension which has an “input” in the layout. When i right click anywhere on the popup.html including the “input” filed, the context menu is not appearing.
Looks like its disabled by default. Is there a way to enable it?

A sample Addon where righ click is not working
https://emojikeyboard.org/

Thanks
Rakesh

I don’t think you can “enable” it.

You will have to create your own. In one of my (unpublished) WebExtensions I do that.

In all my tests, this implementation works very well and is quite close to a native menu. It supports default values, keyboard input, nested menus, avoids overflowing and can display checkboxes and icons:

https://github.com/NiklasGollenstede/youtube/blob/master/common/context-menu.js

I have not documented its (simple) API yet. An example use can be found here:

Here is the result with a dark theme:

I’ve recently created an API request to show custom menus, which would solve this mess:
https://bugzilla.mozilla.org/show_bug.cgi?id=1364401

Showing an HTML Menu is not always a viable option (if the menu is bigger than the popup for example)

I recently fixed context menus in popups. You’ll get them with Firefox 55. See https://bugzilla.mozilla.org/show_bug.cgi?id=1299371

You can add items to the native context menu using both the WebExtension and the HTML context menu API.

1 Like