Making sure the first menu item gets selected as you keyboard navigate into new
menus.
This commit is contained in:
Родитель
b6828b6f17
Коммит
cab23331fc
|
@ -238,6 +238,13 @@ nsMenuBarFrame::KeyboardNavigation(PRUint32 aDirection)
|
|||
else GetPreviousMenuItem(mCurrentMenu, &nextItem);
|
||||
|
||||
SetCurrentMenuItem(nextItem);
|
||||
if (nextItem) {
|
||||
nsMenuFrame* menu = (nsMenuFrame*)nextItem;
|
||||
if (menu->IsOpen()) {
|
||||
// Select the first item.
|
||||
menu->SelectFirstItem();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (aDirection == NS_VK_UP || aDirection == NS_VK_DOWN) {
|
||||
// Open the menu and select its first item.
|
||||
|
|
|
@ -373,5 +373,11 @@ nsMenuFrame::Escape(PRBool& aHandledFlag)
|
|||
void
|
||||
nsMenuFrame::SelectFirstItem()
|
||||
{
|
||||
//XXX Fill in!
|
||||
nsIFrame* frame = mPopupFrames.FirstChild();
|
||||
if (frame) {
|
||||
nsMenuPopupFrame* popup = (nsMenuPopupFrame*)frame;
|
||||
nsIFrame* result;
|
||||
popup->GetNextMenuItem(nsnull, &result);
|
||||
popup->SetCurrentMenuItem(result);
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче