Keeping same item order in drop down content menu?

User Help for Mozilla Firefox
Post Reply
User avatar
Flycaster
Posts: 1167
Joined: November 19th, 2008, 12:13 pm
Location: Boynton Beach, FL

Keeping same item order in drop down content menu?

Post by Flycaster »

I am using Mouse Recorder Premium to open my major programs on start up. The macro works by recording mouse and keyboard movements. One of the items I'm trying to record never stays in the same position. Thus, when recording the macro, often times this item doesn't get selected because it is in a different position. Here is the specific problem:

Firefox Quantum is opened and I wait a bit and then right click which will bring down the content menu. The item in question is Last Pass. There are 5 items at the bottom of the drop down. Four of them maintain their same relative positions, but Last Pass doesn't consistently show up in the same position on a newly opened Firefox. That is, it randomly inserts itself between the other four. One time it will be 2nd from the bottom, another time it will be fourth from the bottom, or third from the bottom. However, it will maintain its initial position on future openings while Firefox stays open.

How can I get the drop down menu to always keep the same ordering?
Windows 11, FF Latest, Edge v94, Thunderbird Latest, Defender
User avatar
jscher2000
Posts: 11762
Joined: December 19th, 2004, 12:26 am
Location: Silicon Valley, CA USA
Contact:

Re: Keeping same item order in drop down content menu?

Post by jscher2000 »

Yes, I've also noticed the entries extensions add to the context menu are not in a stable order. Possibly they are listed in the order the extensions were initialized??

Sometimes you can control the positions of items on menus by setting a style rule in a userChrome.css file. The trick is figuring out the proper CSS selector for that menu item, and a rule to move it to your preferred location.

The general style property you manipulate is the obscure -moz-box-ordinal-group property. This is an example: it moves the "Show All History" item that's normally at the bottom of the history drop-down menu (from the optional icon with the clock on it) and the Library menu's History panel, to the top:

Code: Select all

/* History Button menu */
toolbaritem#PanelUI-history > .panel-header {
  -moz-box-ordinal-group: 2 !important;
}
toolbaritem#PanelUI-history > .panel-subview-body {
  -moz-box-ordinal-group: 3 !important;
  padding-top: 0 !important;
}
toolbaritem#PanelUI-history > #PanelUI-historyMore.panel-subview-footer.subviewbutton {
  -moz-box-ordinal-group: 1 !important;
}
/* Library Button menu History Panel*/
panelview#PanelUI-history > .panel-header {
  -moz-box-ordinal-group: 1 !important;
}
panelview#PanelUI-history > .panel-subview-body {
  -moz-box-ordinal-group: 3 !important;
  padding-top: 0 !important;
}
panelview#PanelUI-history > #PanelUI-historyMore.panel-subview-footer.subviewbutton {
  -moz-box-ordinal-group: 2 !important;
}
/* Fix coloring/reduce height (for both buttons) */
#PanelUI-history > #PanelUI-historyMore.panel-subview-footer.subviewbutton {
  background-color: transparent !important;
  border-top: none !important;
  min-height: 24px !important;
}
#PanelUI-history > #PanelUI-historyMore.panel-subview-footer.subviewbutton:hover {
  background-color: var(--arrowpanel-dimmed) !important;
}
If you aren't familiar with using the Browser Toolbox to research elements of the UI, maybe someone else with LastPass can look into it. Otherwise: https://developer.mozilla.org/docs/Tool ... er_Toolbox
User avatar
Flycaster
Posts: 1167
Joined: November 19th, 2008, 12:13 pm
Location: Boynton Beach, FL

Re: Keeping same item order in drop down content menu?

Post by Flycaster »

Thanks, jsecher. If the code is written out, I then know how to apply it. But, I have no idea how to write the right code.
Also, I'm thinking that LP moving around within the drop down may have something to do with security??? Nothing else in the drop down routinely changes position.
Windows 11, FF Latest, Edge v94, Thunderbird Latest, Defender
User avatar
the-edmeister
Posts: 32249
Joined: February 25th, 2003, 12:51 am
Location: Chicago, IL, USA

Re: Keeping same item order in drop down content menu?

Post by the-edmeister »

I can't help you directly, but I do have notes I have saved for creating a userChrome.css file to deal with an unruly Contextual menu. I have been putting working on this "project" for many months due to Quantum still being changed with almost very new version; hoping for the code to stabilized before I spend the time to "fix it", but now realizing that may not happen any time soon. The continual changes just may become the new "standard" for Firefox as the gradual elimination of XUL proceeds.

The main Contextual Menu has always been a large "bug" of mine with Firefox; many of the default menu items I don't use at all and they just take up too damn much space. I used Menu Editor and then Menu Wizard all the time to hide many menu items, and also to rearrange the order of those that I did use (that I didn't hide). This has been one of the main reasons that I still don't use Quantum very much, still trying to get it configured to my liking; really no closer than I was back in March with Fx 59.

Here are the "notes" I have - not much, but it may he helpful to you.
view-source:chrome://browser/content/browser.xul
then Ctrl + F to search for every instance of contentAreaContextMenu
might work to discover the selector name of context-menu items

or use menuitem[label="<name of item>"] for menuitems e.g. menuitem[label="Open in a New Window"] and menu[label="<name of item>"] for submenus. Also see CSS wildcards.

Code: Select all

Context Menu items

#context-back
#context-bookmarklink
#context-bookmarkpage
#context-forward
#context-inspect
#context-inspect
#context-navigation
#context-openlink
#context-openlinkintab
#context-openlinkinusercontext-menu
#context-openlinkprivate
#context-pocket
#context-reload
#context-savelink
#context-savelinktopocket
#context-savepage
#context-searchselect
#context-selectall
#context-sendlinktodevice
#context-sendpagetodevice
#context-sep-navigation
#context-sep-open
#context-sep-selectall
#context-sep-sendlinktodevice
#context-sep-sendpagetodevice
#context-sep-viewbgimage
#context-sep-viewsource
#context-stop
#context-viewbgimage
#context-viewinfo
#context-viewpartialsource-selection
#context-viewsource
#inspect-separator
#screenshots_mozilla_org_create-screenshot
#ublock0_raymondhill_net_uBlock0-blockElement
The Context Menu Items will be different for each add-on a user has installed. See the last item - #ublock0_raymondhill_net_uBlock0-blockElement - that is the only extension that I had installed when I came up with that list. As Jefferson alluded to. the add-on context menu items are at the bottom, but I can't say if they vary by how Firefox loads them each time Firefox is launched. I have spent too much time working on my other, easier parts of Firefox with userChrome customization code from my "base" userChrome file that goes back to 2004 and converting Stylish User Styles in to userChrome.css / userContent.css "@import url" files to avoid an unruly, huge userChrome.css file.

Good luck.
A mind is a terrible thing to waste. Mine has wandered off and I'm out looking for it.
User avatar
Flycaster
Posts: 1167
Joined: November 19th, 2008, 12:13 pm
Location: Boynton Beach, FL

Re: Keeping same item order in drop down content menu?

Post by Flycaster »

Hey edmeister, thanks for the effort, but I think this project is getting a little too complicated for me. If it was just an easy putting code into the userChrome file, OK; but this is somewhat over my head. I can live with LP appearing in different locations on each FF start up. In fact, probably better that way as the PW won't be accessible to anyone but me.
Windows 11, FF Latest, Edge v94, Thunderbird Latest, Defender
Post Reply