diff --git a/im/base/content/instantbird/accounts.js b/im/base/content/instantbird/accounts.js index 45d5520c9b..987feaccc6 100644 --- a/im/base/content/instantbird/accounts.js +++ b/im/base/content/instantbird/accounts.js @@ -70,6 +70,7 @@ var gAccountManager = { this.setAutoLoginNotification(); + this.accountList.addEventListener("keypress", this.onKeyPress, true); window.addEventListener("unload", this.unload, false); }, unload: function am_unload() { @@ -162,6 +163,23 @@ var gAccountManager = { }, 0, this); }, + onKeyPress: function am_onKeyPress(event) { + // As we stop propagation, the default action applies to the richlistbox + // so that the selected account is changed with this default action + if (event.keyCode == event.DOM_VK_DOWN) { + if (this.selectedIndex < this.itemCount - 1) + this.ensureIndexIsVisible(this.selectedIndex + 1); + event.stopPropagation(); + return; + } + + if (event.keyCode == event.DOM_VK_UP) { + if (this.selectedIndex > 0) + this.ensureIndexIsVisible(this.selectedIndex - 1); + event.stopPropagation(); + } + }, + getAccounts: function am_getAccounts() { var pcs = Components.classes["@instantbird.org/purple/core;1"] .getService(Ci.purpleICoreService);