Closed Bug 1482529 Opened 5 years ago Closed 5 years ago

Implement "visible" parameter in menus.create and menus.update


(WebExtensions :: Frontend, enhancement, P3)



(firefox63 verified)

Tracking Status
firefox63 --- verified


(Reporter: robwu, Assigned: robwu)


(Blocks 1 open bug)


(Keywords: dev-doc-complete)


(2 files)

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:
Can we also implement enabled [1]?

Flags: needinfo?(rob)
(In reply to kernp25 from comment #1)
> Can we also implement enabled [1]?
> [1]

The "enabled" property is already supported by Firefox.
Flags: needinfo?(rob)
This seems like a good idea for both usability and compatibility.
Severity: normal → enhancement
Priority: -- → P3
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
Support "visible" in menus.create and menus.update r=mixedpuppy
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
Note for compat table ( ).
This feature is supported since Firefox 63, Chrome 62 (desktop only) and Opera 49.
Keywords: dev-doc-needed
Attached image 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, and also added it to the compat data.

Marking as dev-doc-complete, but please let me know if we need anything else.
You need to log in before you can comment on or make changes to this bug.