Bug 124310 Up/Down keys in address list should navigate r=timeless sr=mscott

This commit is contained in:
neil%parkwaycc.co.uk 2004-01-15 14:20:48 +00:00
parent 47c0016e8c
commit d95a7e7e7f
2 changed files with 27 additions and 6 deletions

View File

@ -844,6 +844,12 @@ function awRecipientErrorCommand(errItem, element)
function awRecipientKeyPress(event, element)
{
switch(event.keyCode) {
case KeyEvent.DOM_VK_UP:
awArrowHit(element, -1);
break;
case KeyEvent.DOM_VK_DOWN:
awArrowHit(element, 1);
break;
case KeyEvent.DOM_VK_RETURN:
case KeyEvent.DOM_VK_TAB:
{
@ -864,6 +870,19 @@ function awRecipientKeyPress(event, element)
}
}
function awArrowHit(inputElement, direction)
{
var row = awGetRowByInputElement(inputElement) + direction;
if (row) {
var nextInput = awGetInputElement(row);
if (nextInput)
awSetFocus(row, nextInput);
else if (inputElement.value)
awAppendNewRow(true);
}
}
function awRecipientKeyDown(event, element)
{
switch(event.keyCode) {

View File

@ -890,8 +890,7 @@
case KeyEvent.DOM_VK_DOWN:
if (!aEvent.altKey) {
this.clearTimer();
killEvent = true;
this.keyNavigation(aEvent);
killEvent = this.keyNavigation(aEvent);
break;
}
// Alt+Down falls through to history popup toggling code
@ -910,8 +909,7 @@
case KeyEvent.DOM_VK_UP:
if (!aEvent.ctrlKey && !aEvent.metaKey) {
this.clearTimer();
killEvent = true;
this.keyNavigation(aEvent);
killEvent = this.keyNavigation(aEvent);
}
break;
}
@ -935,10 +933,13 @@
k == KeyEvent.DOM_VK_PAGE_UP || k == KeyEvent.DOM_VK_PAGE_DOWN)
{
// up/down keys while menu is closed will open menu
if (!this.mMenuOpen && (this.view.rowCount > 0 || this.alwaysOpenPopup)) {
if (!this.mMenuOpen) {
if (!this.view.rowCount && !this.alwaysOpenPopup)
return false;
this.mNeedToFinish = true;
this.openResultPopup();
return;
return true;
}
this.userAction = "scrolling";
@ -972,6 +973,7 @@
this.mInputElt.setSelectionRange(this.value.length, this.value.length);
this.ignoreInputEvent = false;
}
return true;
]]></body>
</method>