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

Unified Diff: chrome/browser/resources/settings/people_page/change_picture.js

Issue 1720533002: Settings People Revamp: Change Picture: Add accessibility-key usage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@0095-settings-change-picture-announce-messags-old-image-alt-text
Patch Set: Created 4 years, 10 months 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: 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

Powered by Google App Engine
This is Rietveld 408576698