diff --git a/layout/xul/base/src/nsXULPopupManager.cpp b/layout/xul/base/src/nsXULPopupManager.cpp index a64c0e7d2849..a5bdf2049fbf 100644 --- a/layout/xul/base/src/nsXULPopupManager.cpp +++ b/layout/xul/base/src/nsXULPopupManager.cpp @@ -1686,28 +1686,22 @@ nsXULPopupManager::IsValidMenuItem(nsPresContext* aPresContext, nsresult nsXULPopupManager::KeyUp(nsIDOMEvent* aKeyEvent) { - // don't do anything if a menu isn't open or a menubar isn't active - if (!mActiveMenuBar) { - nsMenuChainItem* item = GetTopVisibleMenu(); - if (!item || item->PopupType() != ePopupTypeMenu) - return NS_OK; + nsMenuChainItem* item = GetTopVisibleMenu(); + if (item && item->PopupType() == ePopupTypeMenu) { + aKeyEvent->StopPropagation(); + aKeyEvent->PreventDefault(); } - aKeyEvent->StopPropagation(); - aKeyEvent->PreventDefault(); - return NS_OK; // I am consuming event } nsresult nsXULPopupManager::KeyDown(nsIDOMEvent* aKeyEvent) { - // don't do anything if a menu isn't open or a menubar isn't active - if (!mActiveMenuBar) { - nsMenuChainItem* item = GetTopVisibleMenu(); - if (!item || item->PopupType() != ePopupTypeMenu) - return NS_OK; - } + // don't do anything if a menu isn't open + nsMenuChainItem* item = GetTopVisibleMenu(); + if (!item || item->PopupType() != ePopupTypeMenu) + return NS_OK; PRInt32 menuAccessKey = -1; @@ -1832,8 +1826,8 @@ nsXULPopupManager::KeyPress(nsIDOMEvent* aKeyEvent) HandleShortcutNavigation(keyEvent, nsnull); } - if (mCurrentMenu || mActiveMenuBar) { - // if a menu is open or a menubar is active, it consumes the key event + if (mCurrentMenu) { + // if a menu is open, it consumes the key event aKeyEvent->StopPropagation(); aKeyEvent->PreventDefault(); }