WebExtensions contextmenu menu item icons on browser_action button?

Using Nightly build from 2016-11-25, which includes the newly implemented contextMenus on browser_action button. The browser_action default_icon displays an icon, but the contextMenu items do not.

On the MDN contextMenus page, it is stated:

If you've specified icons for your add-on using the "icons" manifest key,
 context menu items will display the specified icon next to their label.
 The browser will try to choose a 16x16 pixel icon for a normal display 
or a 32x32 pixel icon for a high-density display.

Note that Firefox does not support icons in context menu items until version 47.

However, this doesn’t appear to work as described, and is described ambiguously to begin with.

Problems:

  1. manifest.json has “icons” specified, and the icons are displayed on the Add-ons Manager, but they do not appear on the contextMenu as described.
  2. The MDN description seems to imply that all contextMenu items will have the same icon (which seems silly).
  3. The MDN description does not describe any way to put a unique icon on each contextMenu item.
  4. Putting “icons” in chrome.contextMenus.create() causes “unexpected properties” errors.

The result is that there’s no obvious way demonstrated to put a custom icon for each menu item (as the wording half-implies). A bit confused. Is there an existing bug, or does a new one need creation? Is it not implemented, broken, planned, or implemented but not documented, or not implemented and incorrectly documented?

Any direction here would be great. Also, thank you to all the folks who worked on getting contextMenus added to browser_action and page_action the past few weeks.

manifest.json has “icons” specified, and the icons are displayed on the Add-ons Manager, but they do not appear on the contextMenu as described.

They do for me (actually, if there is only one item, it gets an icon. If there is > 1, then items are placed in a submenu. The submenu’s parent is labeled with the name of the add-on, and only this parent gets an icon).

Try loading the example here: https://github.com/mdn/webextensions-examples/tree/master/context-menu-demo. Do you not see an icon in the context menu, next to “context-menu-demo”? If not, this is a bug.

The MDN description seems to imply that all contextMenu items will have the same icon (which seems silly).

Not exactly. If you only have 1 item, it gets the icon. If you have > 1, as said before, they live in a submenu, without icons, and the submenu’s parent get the icon. What you can’t do is assign different icons to different menu items.

I can see how the docs could be confusing here though, and I just tried to improve this part. Thanks for pointing it out.

The MDN description does not describe any way to put a unique icon on each contextMenu item.

That’s because there isn’t one AFAIK.

Putting “icons” in chrome.contextMenus.create() causes “unexpected properties” errors.

That’s because it isn’t supported.

There is no way to do this. You could file a bug asking for it.

Hello,

I’m having the same issue, the icon in contextMenus is not displayed. I tried with context-menu-demo too and is not working either. And loading my extension in Google Chrome icon is displayed, the problem is only with Firefox.

Any ideas? Thanks