Chromium Code Reviews| Index: ui/webui/resources/cr_elements/cr_profile_avatar_selector/cr_profile_avatar_selector_grid.js |
| diff --git a/ui/webui/resources/cr_elements/cr_profile_avatar_selector/cr_profile_avatar_selector_grid.js b/ui/webui/resources/cr_elements/cr_profile_avatar_selector/cr_profile_avatar_selector_grid.js |
| index 8d75dd5598f733a09d923e2c15f51d1655918b37..694892d8feb5940e91243a5e54c6748cb978ee30 100644 |
| --- a/ui/webui/resources/cr_elements/cr_profile_avatar_selector/cr_profile_avatar_selector_grid.js |
| +++ b/ui/webui/resources/cr_elements/cr_profile_avatar_selector/cr_profile_avatar_selector_grid.js |
| @@ -14,6 +14,37 @@ Polymer({ |
| Polymer.IronMenubarBehavior, |
| ], |
| + properties: { |
| + ignoreModifiedKeyEvents: { |
| + type: Boolean, |
| + value: false, |
| + }, |
| + }, |
| + |
| + /** |
| + * Handler that is called when left arrow key is pressed. Overrides |
| + * IronMenubarBehaviorImpl#_onLeftKey. |
| + * @param {CustomEvent} event |
|
michaelpg
2016/12/19 10:02:46
! (since IronMenubarBehaviorImpl assumes it's non-
Dan Beam
2016/12/20 07:07:57
Done.
|
| + * @private |
| + */ |
| + _onLeftKey: function(event) { |
| + if (this.ignoreModifiedKeyEvents && this.hasKeyModifiers_(event)) |
| + return; |
| + Polymer.IronMenubarBehaviorImpl._onLeftKey.call(this, event); |
| + }, |
| + |
| + /** |
| + * Handler that is called when right arrow key is pressed. Overrides |
| + * IronMenubarBehaviorImpl#_onLeftKey. |
|
michaelpg
2016/12/19 10:02:46
onRightKey
Dan Beam
2016/12/20 07:07:57
Done.
|
| + * @param {CustomEvent} event |
|
michaelpg
2016/12/19 10:02:46
!
Dan Beam
2016/12/20 07:07:57
Done.
|
| + * @private |
| + */ |
| + _onRightKey: function(event) { |
| + if (this.ignoreModifiedKeyEvents && this.hasKeyModifiers_(event)) |
| + return; |
| + Polymer.IronMenubarBehaviorImpl._onRightKey.call(this, event); |
| + }, |
| + |
| /** |
| * Handler that is called when the up arrow key is pressed. |
| * @param {CustomEvent} event A key combination event. |
| @@ -44,6 +75,15 @@ Polymer({ |
| }, |
| /** |
| + * @param {!CustomEvent} event |
| + * @return {boolean} Whether the key event has modifier keys pressed. |
| + */ |
| + hasKeyModifiers_: function(event) { |
| + var keyEv = /** @type {!KeyboardEvent} */(event.detail.keyboardEvent); |
| + return keyEv.altKey || keyEv.ctrlKey || keyEv.metaKey || keyEv.shiftKey; |
|
michaelpg
2016/12/19 10:02:45
maybe it's time for a function in util.js? https:/
Dan Beam
2016/12/20 07:07:56
Done.
|
| + }, |
| + |
| + /** |
| * Focuses an item on the same column as the currently focused item and on a |
| * row below or above the focus row by the given offset. Focus wraps if |
| * necessary. |