Skip to content

Commit

Permalink
Don't show empty context menu item when all format items are disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Nov 13, 2023
1 parent 33d6c44 commit dccccb3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion background/context-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,7 @@ async function onShown(info, tab) {
'context_copyTab_label';
let updated = false;
let useTopLevelItem = false;
const hasMultipleVisibleItems = [...mFormatItems.values()].filter(item => item.visible).length > 1;
for (const item of mMenuItems) {
if (item.hiddenForTopLevelItem)
useTopLevelItem = true;
Expand All @@ -369,7 +370,7 @@ async function onShown(info, tab) {
item.visible = (
!item.hiddenForTopLevelItem &&
configs[item.config] &&
mFormatItems.size > 0 &&
hasMultipleVisibleItems &&
(context.shouldCopyMultipleTabs || (configs.modeForNoSelection != Constants.kCOPY_NOTHING))
);
item.title = browser.i18n.getMessage(titleKey);
Expand Down

0 comments on commit dccccb3

Please sign in to comment.