Commit 94f76462 authored by ultimatedbz's avatar ultimatedbz Committed by Commit bot

Added Home, end, PageUp, PageDown support in the ChromeVox menu

BUG=646238
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation

Review-Url: https://codereview.chromium.org/2350103003
Cr-Commit-Position: refs/heads/master@{#419567}
parent c4fce807
...@@ -442,6 +442,20 @@ Panel.activateMenu = function(menu) { ...@@ -442,6 +442,20 @@ Panel.activateMenu = function(menu) {
} }
}; };
/**
* Sets the index of the current active menu to be 0.
*/
Panel.scrollToTop = function() {
this.activeMenu_.scrollToTop();
};
/**
* Sets the index of the current active menu to be the last index.
*/
Panel.scrollToBottom = function() {
this.activeMenu_.scrollToBottom();
};
/** /**
* Advance the index of the current active menu by |delta|. * Advance the index of the current active menu by |delta|.
* @param {number} delta The number to add to the active menu index. * @param {number} delta The number to add to the active menu index.
...@@ -530,6 +544,18 @@ Panel.onKeyDown = function(event) { ...@@ -530,6 +544,18 @@ Panel.onKeyDown = function(event) {
case 'Escape': case 'Escape':
Panel.closeMenusAndRestoreFocus(); Panel.closeMenusAndRestoreFocus();
break; break;
case 'PageUp':
Panel.advanceItemBy(10);
break;
case 'PageDown':
Panel.advanceItemBy(-10);
break;
case 'Home':
Panel.scrollToTop();
break;
case 'End':
Panel.scrollToBottom();
break;
case 'Enter': case 'Enter':
case ' ': // Space case ' ': // Space
Panel.pendingCallback_ = Panel.getCallbackForCurrentItem(); Panel.pendingCallback_ = Panel.getCallbackForCurrentItem();
......
...@@ -168,6 +168,22 @@ PanelMenu.prototype = { ...@@ -168,6 +168,22 @@ PanelMenu.prototype = {
this.items_[this.activeIndex_].element.focus(); this.items_[this.activeIndex_].element.focus();
}, },
/**
* Sets the active menu item index to be 0.
*/
scrollToTop: function() {
this.activeIndex_ = 0;
this.items_[this.activeIndex_].element.focus();
},
/**
* Sets the active menu item index to be the last index.
*/
scrollToBottom: function() {
this.activeIndex_ = this.items_.length - 1;
this.items_[this.activeIndex_].element.focus();
},
/** /**
* Get the callback for the active menu item. * Get the callback for the active menu item.
* @return {Function} The callback. * @return {Function} The callback.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment