Index: chrome/browser/resources/settings/people_page/change_picture.js |
diff --git a/chrome/browser/resources/settings/people_page/change_picture.js b/chrome/browser/resources/settings/people_page/change_picture.js |
index 0f6c7b7812c2d89aa6c4cf65377095db5d48b24c..43c5ba453cd3a1dbaf0eda73366c85b1db7ac126 100644 |
--- a/chrome/browser/resources/settings/people_page/change_picture.js |
+++ b/chrome/browser/resources/settings/people_page/change_picture.js |
@@ -219,6 +219,54 @@ Polymer({ |
}, |
/** |
+ * Handler for when accessibility-specific keys are pressed. |
+ * @param {!{detail: !{key: string}}} e |
+ */ |
+ onKeysPress_: function(e) { |
+ if (this.selectedItem_ == undefined) |
Dan Beam
2016/02/22 20:41:31
nit: just if (!this.selectedItem_)
tommycli
2016/02/29 19:18:33
Done.
|
+ return; |
+ |
+ // In the old Options user images grid, the 'up' and 'down' keys had |
+ // different behavior depending on whether ChromeVox was on or off. |
+ // If ChromeVox was on, 'up' or 'down' would select the next or previous |
+ // image on the left or right. If ChromeVox was off, it would select the |
+ // image spatially above or below using calculated columns. |
+ // |
+ // The code below implements the simple behavior of selecting the image |
+ // to the left or right (as if ChromeVox was always on). |
+ // |
+ // TODO(tommycli): Investigate if it's necessary to calculate columns |
+ // and select the image on the top or bottom for non-ChromeVox users. |
+ switch (e.detail.key) { |
+ case 'up': |
+ case 'left': |
+ do { |
+ this.$.selector.selectPrevious(); |
+ } while (this.selectedItem_.hidden); |
Dan Beam
2016/02/22 20:41:31
what assurance do we have that this breaks out of
tommycli
2016/02/29 19:18:33
I added a comment: This loop always terminates bec
|
+ |
+ this.lastSelectedImageType_ = this.selectedItem_.dataset.type; |
+ break; |
Dan Beam
2016/02/22 20:41:31
nit: \n
tommycli
2016/02/29 19:18:33
Done.
|
+ case 'down': |
+ case 'right': |
+ do { |
+ this.$.selector.selectNext(); |
+ } while (this.selectedItem_.hidden); |
+ |
+ this.lastSelectedImageType_ = this.selectedItem_.dataset.type; |
+ break; |
Dan Beam
2016/02/22 20:41:31
nit: \n
tommycli
2016/02/29 19:18:33
Done.
|
+ case 'enter': |
+ case 'space': |
+ if (this.selectedItem_.dataset.type == 'camera') |
+ this.$.camera.takePhoto(); |
+ else if (this.selectedItem_.dataset.type == 'file') |
+ settings.ChangePicturePrivateApi.chooseFile(); |
+ else if (this.selectedItem_.dataset.type == 'old') |
+ this.onTapDiscardOldImage_(); |
+ break; |
+ } |
+ }, |
+ |
+ /** |
* Handler for when the an image is activated. |
* @param {!Event} event |
* @private |