Currently, when an extension wants to hide a menu, they have to resort to one of the following methods hacks: - Remove menu via the remove or removeAll methods in the menus or contextMenus namespace. (disadvantage: menu order is lost because menus are currently shown in the order of creation) - Update the menu with the update method, and set one of the values to something that never matches. Neither method is ideal, and I was wondering whether there is a better way to offer this functionality. Turns out, Chrome's contextMenus API already offers the "visible" property which fulfills these needs. Chrome supports this since version 62: https://bugs.chromium.org/p/chromium/issues/detail?id=463476 https://developer.chrome.com/extensions/contextMenus#property-createProperties-visible
Can we also implement enabled ?  https://developer.chrome.com/extensions/contextMenus#property-createProperties-enabled
(In reply to kernp25 from comment #1) > Can we also implement enabled ? > >  https://developer.chrome.com/extensions/contextMenus#property-createProperties-enabled The "enabled" property is already supported by Firefox.
This seems like a good idea for both usability and compatibility.
Severity: normal → enhancement
Priority: -- → P3
Created attachment 9002469 [details] Bug 1482529 - Support "visible" in menus.create and menus.update
Comment on attachment 9002469 [details] Bug 1482529 - Support "visible" in menus.create and menus.update Shane Caraveo (:mixedpuppy) has approved the revision.
Attachment #9002469 - Flags: review+
Pushed by email@example.com: https://hg.mozilla.org/integration/autoland/rev/f66ffcb2e82a Support "visible" in menus.create and menus.update r=mixedpuppy
Status: ASSIGNED → RESOLVED
Last Resolved: 6 months ago
status-firefox63: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
Note for compat table ( https://github.com/mdn/browser-compat-data ). This feature is supported since Firefox 63, Chrome 62 (desktop only) and Opera 49.
Created attachment 9004550 [details] Bug1482529.gif This issue is verified as fixed on Firefox 63.0a1(20180827100129) under Win 7 64-bit and Mac OS X 10.13.3. The “visible” parameter work as expected for menus.create and menus.update. Please see the attached video.
I've added `visible` to the `createProperties` object in https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/menus/create, and also added it to the compat data. Marking as dev-doc-complete, but please let me know if we need anything else.
Keywords: dev-doc-needed → dev-doc-complete
You need to log in before you can comment on or make changes to this bug.