mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 13:51:41 +00:00
Bug 1272012 - Support more keys to open and/or toggle a combobox dropdown menu. r=enndeakin
This commit is contained in:
parent
9d77d9f4ce
commit
551e9fc180
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user