Create browser.menus.show(contextType, parameters, contextParameters);

RESOLVED WONTFIX

Status

enhancement
P3
normal
RESOLVED WONTFIX
2 years ago
10 months ago

People

(Reporter: ntim, Unassigned)

Tracking

unspecified

Firefox Tracking Flags

(firefox57 wontfix)

Details

(Whiteboard: [design-decision-approved][contextMenus][ntim-backlog])

It would be nice to have a method that shows built-in context menus.

What I would suggest is the following API:

browser.menus.show(contextType, { location: "browser_action/page_action/sidebar_action/webcontent", x: ..., y: ..., }, contextParameters);

contextType corresponds to one of the following ContextTypes: https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/contextMenus/ContextType


x and y are relative to the location.

contextParameters depends on the contextType chosen, for example, the tab context menu would take a WE tabId.

Use cases:
- Showing the tab context menu for sidebar tabs
browser.menus.show("tab", { location: "sidebar_action", x: ..., y: ... }, tabId);

You can reimplement the context menu from scratch, but that would have the following drawbacks: extensions can't integrate, the sidebar tabs extension will be out of date with firefox context menu changes, etc.

- Showing the bookmarks context menu for an advanced bookmarks manager

- UI tour for context menu items provided by an extension

An alternative approach has been suggested for the first use case: bug 1280347
Another alternative for the first use case would be having a browser.tabstrip namespace with 2 features:

- showing or hiding the tabstrip (bug 1332447)

browser.tabstrip.hide/show()

- showing the tabstrip context menu

browser.tabstrip.showContextMenu(tabId, { location, x, y });
Whiteboard: [design-decision-needed]
This is very important for addon authors planning to migrate their addon including custom tab UI, from XUL to WebExtensions. Actually, my "Tree Style Tab" addon is already rebuilt on WebExtensions APIs mostly and only context menu is the largest one left as unmigrated feature...
(FYI, unsigned development build: https://piro.sakura.ne.jp/xul/xpi/nightly/treestyletab-we.xpi )
Priority: -- → P3
Whiteboard: [design-decision-needed] → [design-decision-needed][contextMenus]
This bug as approved at the design decision triage meeting on January 23, 2018. 

Meeting notes can be found here: https://docs.google.com/document/d/1Mc0h5OVd30WBjCORssdifZRXYQrk6WcTqX1cw6ADO9k/edit#
Whiteboard: [design-decision-needed][contextMenus] → [design-decision-approved][contextMenus]
See Also: → 1376251
Whiteboard: [design-decision-approved][contextMenus] → [design-decision-approved][contextMenus][ntim-backlog]
Product: Toolkit → WebExtensions
We don't want extensions to open arbitrary menus without user interaction.

We do want to allow extensions to be able to develop custom tab/bookmark managers.

I'm going to mark this as WONTFIX because this specific API implementation suggestion will not be followed.
Instead, I'm going to implement the ability to specify a custom context when an extension menu is opened, in bug 1280347.
No longer blocks: 1466876
See Also: → 1280347
Status: NEW → RESOLVED
Closed: 10 months ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.