menu should support popup attribute

NEW
Unassigned

Status

()

Core
XUL
--
enhancement
10 years ago
8 years ago

People

(Reporter: myk, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Reporter)

Description

10 years ago
Created attachment 345033 [details]
testcase demonstrating problem

The <menu> element only supports a <menupopup> child element for specifying its popup, it doesn't also support the 'popup' attribute.  Support for the 'popup' attribute would be useful, because it would allow the same popup to be shared by both a menu (f.e. a submenu of the Tools menu) and a toolbar button.

I've attached a testcase demonstrating the problem.
(Reporter)

Comment 1

10 years ago
Note: bug 314020 should be fixed concurrently with this bug.

Comment 2

9 years ago
Hi,

yes I was fighting with this issue recently and I completely agree. It would prevent from duplicating a same menu in several places, especially when this menu is changing during execution of the program (so having to duplicate this menu means you have to take care of always add/remove items in all menus in same time, with high risk of synchronization bugs with the software growing up).

A "workaround" is to use for instance a "button" element instead of a "menu" element, but then you have to take care of the appearance position of the menu as well as the style of this button (to look like a menu), but this will be a problem depending of your platform/theme.
If this can be fixed, it would be great.
Thanks.

Updated

9 years ago
Assignee: jag → nobody

Comment 3

8 years ago
Just ran into the same cul-de-sac, which meant quite a lot of code duplication. :-(

Comment 4

8 years ago
Created attachment 456959 [details] [diff] [review]
Add support for "popup" attribute on a menu element

Can anyone suggest a reviewer for this patch (Roc, Boris)?
Attachment #456959 - Flags: review?
enndeakin would be the right reviewer.

Updated

8 years ago
Attachment #456959 - Flags: review? → review?(enndeakin)

Comment 6

8 years ago
Comment on attachment 456959 [details] [diff] [review]
Add support for "popup" attribute on a menu element

Unfortunately, it's not as simple as this.

There are a number of places which assume that a menu's popup is a direct child and/or that a menupopup will have a menuframe parent when it is a menu.

For instance, a simple test with this patch shows issues the the 'open' state isn't updated correctly, and the submenus don't disappear properly when moving the mouse away from them.

Also note that nsMenuFrame references mPopupFrame directly and doesn't go through GetPopup, so it will retrieve a different frame.
Attachment #456959 - Flags: review?(enndeakin) → review-
You need to log in before you can comment on or make changes to this bug.