Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Unified Diff: ui/webui/resources/cr_elements/cr_profile_avatar_selector/cr_profile_avatar_selector_grid.js

Issue 2586113002: MD Settings: ignore modified key events in the profile avatar grid (Closed)
Patch Set: closure, take 2 Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..30444f741b7c0599189fae137b67c3e3524cac09 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
+ * @private
+ */
+ _onLeftKey: function(event) {
+ if (this.ignoreModifiedKeyEvents && this.hasKeyModifiers_(event))
Moe 2016/12/20 19:07:40 nit: please add a comment why this is being overri
Dan Beam 2016/12/20 19:31:15 Done.
+ return;
+ Polymer.IronMenubarBehaviorImpl._onLeftKey.call(this, event);
+ },
+
+ /**
+ * Handler that is called when right arrow key is pressed. Overrides
+ * IronMenubarBehaviorImpl#_onRightKey.
+ * @param {!CustomEvent} event
+ * @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,14 @@ Polymer({
},
/**
+ * @param {!CustomEvent} event
+ * @return {boolean} Whether the key event has modifier keys pressed.
+ */
+ hasKeyModifiers_: function(event) {
+ return hasKeyModifiers(assertInstanceof(event.detail.keyboardEvent, Event));
+ },
+
+ /**
* 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.

Powered by Google App Engine
This is Rietveld 408576698