WebExtension Context Menu: Specified Element Only?

Is it possible to add a context menu to a single specified element? Failing that, to a specific element type?

All I can gather from the available contexts in the documentation imply that you can specify certain types of elements, such as images. However, I would like to limit a context menu further, such as to input elements only, or better still, matching a querySelector.

Thanks

As a Firefox-only solution you can:

  1. attach a content script to all relevent tabs, in which
  2. you use to inject HTML <menu> elements to the page.

Now that is pretty nice. I think that’s a simpler solution than the alternative anyway.

I see that it also works in Chrome, and I’ll try not to get too upset about not working in Edge.

Thanks

“I see that it also works in Chrome” I was suprised by that, tried it with the example in the green box and it didn’t

You’re right. It was only available as an experimental feature behind a flag, and that flag was removed in version 52 in favor of a runtime flag. Oh well.