We're calling on all EU-based Mozillians with iOS or iPadOS devices to help us monitor Apple’s new browser choice screens. Join the effort to hold Big Tech to account!

為了改善您的使用體驗,本網站正在進行維護,部分功能暫時無法使用。若本站的文件無法解決您的問題,想要向社群發問的話,請到 Twitter 上的 @FirefoxSupport 或 Reddit 上的 /r/firefox 發問,我們的社群成員將很快會回覆您的疑問。

搜尋 Mozilla 技術支援網站

防止技術支援詐騙。我們絕對不會要求您撥打電話或發送簡訊,或是提供個人資訊。請用「回報濫用」功能回報可疑的行為。

了解更多

HIDING / REMOVAL OF CONTEXT MENU ICONS

  • 8 回覆
  • 1 有這個問題
  • 2 次檢視
  • 最近回覆由 deanone

more options

I generally block icons from showing inside Firefox context menus. In most cases my practice would be to simply block .menu-iconic-left via userChrome. With the latest versions of Firefox this also blocks the display of the #contentAreaContextMenu navigation icons. This would normally not be an issue as I would apply the blocking of icons to individual context menu items instead i.e.

  1. CONTEXT-MENU-ITEM > .menu-iconic-left {
  display: none !important;

} However, there are some context menu items added by extensions which have a number suffix in their element name - An example would be #CONTEXT-MENU-ITEM-### where '###' represents a number that changes with each page opened. In this instance, my efforts to block the .menu-iconic-left element are thwarted as the element name is effectively different when the above-mentioned number changes.

Is there a CSS means of applying the code with the inclusion of a number range? Unless of course I'm barking up the wrong tree and there is a much simpler solution.

I generally block icons from showing inside Firefox context menus. In most cases my practice would be to simply block .menu-iconic-left via userChrome. With the latest versions of Firefox this also blocks the display of the #contentAreaContextMenu navigation icons. This would normally not be an issue as I would apply the blocking of icons to individual context menu items instead i.e. #CONTEXT-MENU-ITEM > .menu-iconic-left { display: none !important; } However, there are some context menu items added by extensions which have a number suffix in their element name - An example would be #CONTEXT-MENU-ITEM-### where '###' represents a number that changes with each page opened. In this instance, my efforts to block the .menu-iconic-left element are thwarted as the element name is effectively different when the above-mentioned number changes. Is there a CSS means of applying the code with the inclusion of a number range? Unless of course I'm barking up the wrong tree and there is a much simpler solution.

被選擇的解決方法

Not ideal but solves the issue...and thanks again to both of you for looking at this.

/* REMOVAL OF EXTENSION CONTEXT MENU ICONS */

menuitem[image*="moz-extension://"] .menu-iconic-left,
menu[image*="moz-extension://"] .menu-iconic-left {
 display: none !important;

}

/* SET PADDING-LEFT AS THE SAME VALUE ACROSS ALL RELEVANT MENUS INCLUDING TEXT-AREA CONTEXT MENUS */

menu, menuitem {
 padding-left: 13px !important;

}

/* FIX FOR CONTEXT NAVIGATION ITEMS */

#context-back, #context-forward, #context-reload, #context-bookmarkpage {
 padding-left: 0px !important;

}

從原來的回覆中察看解決方案 👍 0

所有回覆 (8)

more options

Try this -- it takes advantage of a partial (wildcard) attribute value match on the menu item to identify extensions:

/* Hide Extension Buttons on Context Menus */
menuitem[image*="moz-extension://"] .menu-iconic-left,
menu[image*="moz-extension://"] .menu-iconic-left {
  display: none;
}


https://developer.mozilla.org/docs/Web/CSS/Attribute_selectors

more options

Yes that did the trick! Thank you for the prompt reply...

It's worth a mention that Firefox context menu items now have reduced padding-left with the exception of in-page search field context menus (menu items are still centered). When either your solution or my original approach are applied it leaves this particular menu with extension menu items where expected (left-sided) but the other items remain centered. If the padding-left value is set the same across all menus to defeat this, the #context-navigation element is thrown out of whack.

more options

> with the exception of in-page search field context menus (menu items are still centered).

Hmm, I see that extra left padding on the context menu for this textarea. There's a checkmark for Check Spelling, so maybe that's why the space is there for certain menus. Firefox must have some way that it distinguishes between these menus, but... my time's up for poking at it.

Have you been using the Browser Toolbox for your exploration? There's a preference to force menus to stick open until you press Esc, which is necessary to use "click to inspect" with them.

more options

Maybe this code that hides the icons works better as display:none move the label text to the left end.


@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* only needed once */

#contentAreaContextMenu :is(menuitem[image*="moz-extension://"],menu[image*="moz-extension://"]) .menu-iconic-left { visibility: hidden !important; }
more options

Yes I actively use the Browser Toolbox including the preference you refer to. I'll have another look at it and post back when I have a solution.

more options

I posted some other code you can try a few seconds before your last post.

more options

@cor-el Yes I had previously considered this and thank you, however, although it leaves the in-page search field context menu items centered, in the remaining #contentAreaContextMenu menus leave the extension items centered and not to the left as the icon is only 'hidden'.

My thoughts would be to address the in-page search field context menu itself. Will post back once I've had a look at it.

more options

選擇的解決方法

Not ideal but solves the issue...and thanks again to both of you for looking at this.

/* REMOVAL OF EXTENSION CONTEXT MENU ICONS */

menuitem[image*="moz-extension://"] .menu-iconic-left,
menu[image*="moz-extension://"] .menu-iconic-left {
 display: none !important;

}

/* SET PADDING-LEFT AS THE SAME VALUE ACROSS ALL RELEVANT MENUS INCLUDING TEXT-AREA CONTEXT MENUS */

menu, menuitem {
 padding-left: 13px !important;

}

/* FIX FOR CONTEXT NAVIGATION ITEMS */

#context-back, #context-forward, #context-reload, #context-bookmarkpage {
 padding-left: 0px !important;

}

由 deanone 於 修改