Index: chrome/browser/resources/chromeos/chromevox/cvox2/background/panel_menu.js |
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/panel_menu.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/panel_menu.js |
index f8c75b21236f1b98af4f2c7d1314064084ddb070..d94914cc95c64be2f4468eed54396cf05dac01cc 100644 |
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/panel_menu.js |
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/panel_menu.js |
@@ -62,6 +62,9 @@ PanelMenu = function(menuMsg) { |
* @private |
*/ |
this.activeIndex_ = -1; |
+ |
+ this.menuElement.addEventListener( |
+ 'keypress', this.onKeyPress_.bind(this), true); |
}; |
PanelMenu.prototype = { |
@@ -187,6 +190,20 @@ PanelMenu.prototype = { |
return this.items_[i].callback; |
} |
return null; |
+ }, |
+ |
+ /** |
+ * Handles key presses for first letter accelerators. |
+ */ |
+ onKeyPress_: function(evt) { |
+ var query = String.fromCharCode(evt.charCode).toLowerCase(); |
+ |
+ for (var i = this.activeIndex_ + 1; i < this.items_.length; i++) { |
+ if (this.items_[i].text.toLowerCase().indexOf(query) == 0) { |
+ this.activateItem(i); |
+ break; |
+ } |
+ } |
} |
}; |