| Index: ui/webui/resources/cr_elements/cr_action_menu/cr_action_menu.js
|
| diff --git a/ui/webui/resources/cr_elements/cr_action_menu/cr_action_menu.js b/ui/webui/resources/cr_elements/cr_action_menu/cr_action_menu.js
|
| index 9f58dc4f6cd9079f59c2ee05364b0f1f5aef5e46..a8e065db682e77c39cd3f2a1cb2e694e684c8ea7 100644
|
| --- a/ui/webui/resources/cr_elements/cr_action_menu/cr_action_menu.js
|
| +++ b/ui/webui/resources/cr_elements/cr_action_menu/cr_action_menu.js
|
| @@ -32,6 +32,7 @@ Polymer({
|
|
|
| listeners: {
|
| 'keydown': 'onKeyDown_',
|
| + 'mouseover': 'onMouseover_',
|
| 'tap': 'onTap_',
|
| },
|
|
|
| @@ -73,6 +74,12 @@ Polymer({
|
| return;
|
| }
|
|
|
| + var mouseHandler = function(e) {
|
| + this.onMouseover_(e);
|
| + this.removeEventListener('mousemove', mouseHandler);
|
| + };
|
| + this.addEventListener('mousemove', mouseHandler);
|
| +
|
| if (e.key !== 'ArrowDown' && e.key !== 'ArrowUp')
|
| return;
|
|
|
| @@ -84,6 +91,24 @@ Polymer({
|
| },
|
|
|
| /**
|
| + * @param {!MouseEvent} e
|
| + * @private
|
| + */
|
| + onMouseover_: function(e) {
|
| + // TODO(scottchen): Using "focus" to determine selected item might mess
|
| + // with screen readers in some edge cases.
|
| + for (var i = 0, el = e.path[0]; this != el; el = e.path[i++]) {
|
| + if (el.classList && el.classList.contains('dropdown-item')) {
|
| + el.focus();
|
| + return;
|
| + }
|
| + };
|
| +
|
| + // Reached dialog, so el is not an option.
|
| + this.focus(); // Blur option focus but keep up/down button working.
|
| + },
|
| +
|
| + /**
|
| * @param {number} step -1 for getting previous option (up), 1 for getting
|
| * next option (down).
|
| * @return {?Element} The next focusable option, taking into account
|
|
|