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..f25c8e8ec42f1c427c0a54f5569054dc5eec4c75 100644 |
--- a/chrome/browser/resources/shared/js/cr/ui/grid.js |
+++ b/chrome/browser/resources/shared/js/cr/ui/grid.js |
@@ -350,12 +350,27 @@ 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 && |
Evan Stade
2012/05/07 20:58:02
cvox.Api checked twice
|
+ 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) { |
Evan Stade
2012/05/07 20:58:02
no curlies
|
return -1; |
@@ -371,6 +386,8 @@ cr.define('cr.ui', function() { |
* @override |
*/ |
getIndexAbove: function(index) { |
+ if (this.isAccessibilityEnabled()) |
+ return this.getIndexBefore(index); |
if (index == 0) { |
Evan Stade
2012/05/07 20:58:02
no curlies
|
return -1; |
} |