Closed Bug 332845 Opened 18 years ago Closed 17 years ago

Menu Dismissal Listener does not handle multiple active chains


(Core :: XUL, defect)

Not set





(Reporter: bugs, Unassigned)



If there are multiple active chains visible at the same time, the Menu Dismissal Listener only successfully handles cleaning up the most recent one. 

You can easily construct multiple active chains like so:

- open a context menu on a regular menu (the context menu is in a separate chain of menus to the menu it was opened on)
- perform a drag operation from one menu to another (during the drag, the second menu is sprung open while the first is left open, so that when the user drops the second menu closes while the first remains around).

The bug appears to be in the way the MenuDismissalListener works. As menus are opened, the most nested menu is set as the current "Menu Parent" in the MenuDismissalListener. This ensures that when that item is closed its parent chain will be closed too. However if a new chain is created, the old chain is lost and never closed.

One solution for this problem might be as follows:

- when SetCurrentMenuParent is called, check if the new MenuParent is a context menu
- If it is, cache the old menu parent as an "alternate" in an additional member variable, then replace the menu parent with the context menu one.
- If it's not, dismiss the old chain. 

The reason is that for context menus on menus, you want to retain both hierarchies (you can never have more than two of course, so only an additional member variable is required, rather than a list). For drag and drop, you want to snap the source menu closed.
Depends on: 279703
Should now be fixed with bug 279703.
Closed: 17 years ago
Resolution: --- → FIXED
Component: XP Toolkit/Widgets: Menus → XUL
QA Contact: xptoolkit.menus → xptoolkit.widgets
You need to log in before you can comment on or make changes to this bug.