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

Unified Diff: chrome/browser/resources/shared/js/cr/ui/grid.js

Issue 10376003: Improve accessibility of user image selection screen. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Manually verified with fresh Chrome OS build. Created 8 years, 4 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/shared/js/cr/ui/grid.js
diff --git a/chrome/browser/resources/shared/js/cr/ui/grid.js b/chrome/browser/resources/shared/js/cr/ui/grid.js
index d078afe9189cf49e9b08f79dd20be6402c592b85..02e84bb037ca1a79b9d7d13651043fdc24ed526a 100644
--- a/chrome/browser/resources/shared/js/cr/ui/grid.js
+++ b/chrome/browser/resources/shared/js/cr/ui/grid.js
@@ -24,7 +24,7 @@ cr.define('cr.ui', function() {
* @extends {cr.ui.ListItem}
*/
function GridItem(dataItem) {
- var el = cr.doc.createElement('span');
+ var el = cr.doc.createElement('li');
el.dataItem = dataItem;
el.__proto__ = GridItem.prototype;
return el;
@@ -350,16 +350,30 @@ cr.define('cr.ui', function() {
__proto__: ListSelectionController.prototype,
/**
+ * Check if accessibility is enabled: if ChromeVox is running
+ * (which provides spoken feedback for accessibility), make up/down
+ * behave the same as left/right. That's because the 2-dimensional
+ * structure of the grid isn't exposed, so it makes more sense to a
+ * user who is relying on spoken feedback to flatten it.
+ * @return {boolean} True if accessibility is enabled.
+ */
+ isAccessibilityEnabled: function() {
+ return window.cvox && cvox.Api &&
+ cvox.Api.isChromeVoxActive && cvox.Api.isChromeVoxActive();
+ },
+
+ /**
* Returns the index below (y axis) the given element.
* @param {number} index The index to get the index below.
* @return {number} The index below or -1 if not found.
* @override
*/
getIndexBelow: function(index) {
+ if (this.isAccessibilityEnabled())
+ return this.getIndexAfter(index);
var last = this.getLastIndex();
- if (index == last) {
+ if (index == last)
return -1;
- }
index += this.grid_.columns;
return Math.min(index, last);
},
@@ -371,9 +385,10 @@ cr.define('cr.ui', function() {
* @override
*/
getIndexAbove: function(index) {
- if (index == 0) {
+ if (this.isAccessibilityEnabled())
+ return this.getIndexBefore(index);
+ if (index == 0)
return -1;
- }
index -= this.grid_.columns;
return Math.max(index, 0);
},

Powered by Google App Engine
This is Rietveld 408576698