Closed Bug 1482529 Opened 6 years ago Closed 6 years ago

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

Categories

(WebExtensions :: Frontend, enhancement, P3)

enhancement

Tracking

(firefox63 verified)

VERIFIED FIXED
mozilla63
Tracking Status
firefox63 --- verified

People

(Reporter: robwu, Assigned: robwu)

References

(Blocks 1 open bug)

Details

(Keywords: dev-doc-complete)

Attachments

(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: https://bugs.chromium.org/p/chromium/issues/detail?id=463476 https://developer.chrome.com/extensions/contextMenus#property-createProperties-visible
Flags: needinfo?(rob)
(In reply to kernp25 from comment #1) > Can we also implement enabled [1]? > > [1] https://developer.chrome.com/extensions/contextMenus#property-createProperties-enabled 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 rob@robwu.nl: https://hg.mozilla.org/integration/autoland/rev/f66ffcb2e82a Support "visible" in menus.create and menus.update r=mixedpuppy
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
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.
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.
Status: RESOLVED → VERIFIED
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.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: