How to get the x and y coordinates of mouse click on browser action context menu item

My Firefox add-on is adding a context menu to its browser action (browser toolbar button) using browser.menus.create() and specifying the “browser_action” context. This context menu item will open an extension page in its own popup window.

Is there a way to get the x and y screen coordinates of the toolbar button from where the right-click originated from? I want to be able to set the position of the popup window so that it is adjacent to the toolbar button from which the context menu item invocation happened.

In Firefox maybe partially yes, see " targetElementId":


That way you should get the element on which the context menu was opened and then use getBoundingClientRect to get coordinates.