Open Bug 461899 Opened 16 years ago Updated 2 years ago

menu should support popup attribute

Categories

(Core :: XUL, enhancement)

enhancement

Tracking

()

People

(Reporter: myk, Unassigned)

Details

Attachments

(2 files)

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.
Note: bug 314020 should be fixed concurrently with this bug.
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.
Assignee: jag → nobody
Just ran into the same cul-de-sac, which meant quite a lot of code duplication. :-(
Can anyone suggest a reviewer for this patch (Roc, Boris)?
Attachment #456959 - Flags: review?
enndeakin would be the right reviewer.
Attachment #456959 - Flags: review? → review?(enndeakin)
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-
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: