I'd like to make a browser extension that either show an information about an element straight on the context menu or at least allow me to analyse the element after I clicked my context menu item. Basically it should at least behave like "inspect", that is knowing which element I'm on when the context menu appears.
Right now I've found a way to create the context menu with browser.contextmenu.create, even if it's not dynamic. The problem is there is no way to get the element where I was. I thought to have a background page that inject I inject on all pages to catch coordinates on a right click but I have problems understanding how to preemptively inject it or do it when I create the menu item.
Am I following the wrong route? I didn't find any info online and searching for "browser inspect xxx" will always show only how to use it.