I have an extension that can be placed on any toolbar (like the bookmarks, menu or status bars). In general, the context menu opens downward, but when placed on the status bar and Firefox is closed to the bottom of the screen, the context menu opens upward. I'd like to try reordering the context menu based on its up or down orientation, so that the same options are always closest to the mouse.
For example, when opened downward it appears like this:
--> (mouse) --------------- - MenuItem A - --------------- - MenuItem B - --------------- - MenuItem C - --------------- - ....... - ---------------
When it opens upwards its like this:
--------------- - MenuItem A - --------------- - MenuItem B - --------------- - MenuItem C - --------------- - ....... - --------------- --> (mouse)
However, I'd like "MenuItem A" to appear closest to the mouse at all times, since its the most common item. I can render the items dynamically, so I really just need to find out the orientation.