contexts in contextMenus for parent & child menus

RESOLVED DUPLICATE of bug 1324429

Status

P3
normal
RESOLVED DUPLICATE of bug 1324429
3 years ago
4 months ago

People

(Reporter: eros_uk, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: triaged[intent-to-close])

(Reporter)

Description

3 years ago
FF45.0.2 Win7

In nested contextMenu i.e. where there is a parent and child (submenu), setting the contexts on the parent menu should apply to its child-menus (unless specifically stated otherwise)

Via trial & error, the only way I could get the menus to show/hide based on contexts was to set the contexts for all of them.

- Setting the contexts on parent menu only has no effect.
- Setting the contexts on child-menus shows/hides the child-menu (although it shows an unsightly small square) but not the parent.

Here is an example:

var contexts = ['selection', 'link'];

browser.contextMenus.create({'title': 'Title', 'id': 'parent', 'contexts': contexts});
browser.contextMenus.create({'title': 'Action 1', 'parentId': 'parent', 'id': 'child1', 'contexts': contexts, 'onclick': process});
browser.contextMenus.create({'title': 'Action 2', 'parentId': 'parent', 'id': 'child2', 'contexts': contexts, 'onclick': process});

Comment 1

3 years ago
The limitation seems same to Google Chrome's spec.
http://stackoverflow.com/questions/11468798/create-two-child-menus-for-every-parent-menu-in-chrome-extension
http://stackoverflow.com/questions/14818714/adding-children-to-context-menu-links/18198476#18198476
I also think that child context menu items should inherit default `contexts` from the parent item, isntead of static defaults `["page"]`. But there is a problem: the change will break compatibility with Google Chrome.
Status: UNCONFIRMED → NEW
Ever confirmed: true

Comment 2

3 years ago
need to discuss on list if there is enough reason to break from following compatibility with Chrome in this area.
Priority: -- → P3
Whiteboard: triaged
Doing more with context menus was a frequent request in the developer survey.
(Reporter)

Comment 4

3 years ago
Firefox 46: New Bug
The parent menu is not hidden by contexts anymore (same code as above).
(Reporter)

Comment 5

2 years ago
Firefox 47:
Above bug is still present (parent menu does not hide according to context)

Comment 6

2 years ago
Is there a way we can do this that would avoid breaking compat. with Chrome? Otherwise I'd suggest won't fixing.
Whiteboard: triaged → triaged[intent-to-close]

Updated

2 years ago
Component: WebExtensions: Untriaged → WebExtensions: Frontend
The other bug has a patch.
Status: NEW → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 1324429

Updated

4 months ago
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.