diff --git a/layout/forms/nsListControlFrame.cpp b/layout/forms/nsListControlFrame.cpp index d30e80f49831..e744e12b2a50 100644 --- a/layout/forms/nsListControlFrame.cpp +++ b/layout/forms/nsListControlFrame.cpp @@ -2108,10 +2108,25 @@ nsListControlFrame::KeyDown(nsIDOMEvent* aKeyEvent) MOZ_ASSERT(keyEvent, "DOM event must have WidgetKeyboardEvent for its internal event"); - if (keyEvent->IsAlt()) { - if (keyEvent->mKeyCode == NS_VK_UP || keyEvent->mKeyCode == NS_VK_DOWN) { - DropDownToggleKey(aKeyEvent); + bool dropDownMenuOnUpDown; + bool dropDownMenuOnSpace; +#ifdef XP_MACOSX + dropDownMenuOnUpDown = IsInDropDownMode() && !mComboboxFrame->IsDroppedDown(); + dropDownMenuOnSpace = !keyEvent->IsAlt() && !keyEvent->IsControl() && + !keyEvent->IsMeta(); +#else + dropDownMenuOnUpDown = keyEvent->IsAlt(); + dropDownMenuOnSpace = IsInDropDownMode() && !mComboboxFrame->IsDroppedDown(); +#endif + if ((dropDownMenuOnUpDown && + (keyEvent->mKeyCode == NS_VK_UP || keyEvent->mKeyCode == NS_VK_DOWN)) || + (dropDownMenuOnSpace && keyEvent->mKeyCode == NS_VK_SPACE)) { + DropDownToggleKey(aKeyEvent); + if (keyEvent->DefaultPrevented()) { + return NS_OK; } + } + if (keyEvent->IsAlt()) { return NS_OK; }