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

Unified Diff: chrome/browser/resources/chromeos/chromevox/common/dom_util.js

Issue 2479593007: Expose images to accessibility (Closed)
Patch Set: Created 4 years, 1 month 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/chromeos/chromevox/common/dom_util.js
diff --git a/chrome/browser/resources/chromeos/chromevox/common/dom_util.js b/chrome/browser/resources/chromeos/chromevox/common/dom_util.js
index 827b062f30d98049aa1a419fc210cde12b52c8fd..138abac68b6067577a7aa49dec849d18e70c574d 100644
--- a/chrome/browser/resources/chromeos/chromevox/common/dom_util.js
+++ b/chrome/browser/resources/chromeos/chromevox/common/dom_util.js
@@ -480,7 +480,7 @@ cvox.DomUtil.getBaseLabel_ = function(node, recursive, includeControls) {
} else if (node.hasAttribute('aria-label')) {
label = node.getAttribute('aria-label');
} else if (node.constructor == HTMLImageElement) {
- label = cvox.DomUtil.getImageTitle(node);
+ label = 'img ' + cvox.DomUtil.getImageTitle(node);
} else if (node.tagName == 'FIELDSET') {
// Other labels will trump fieldset legend with this implementation.
// Depending on how this works out on the web, we may later switch this
@@ -920,10 +920,13 @@ cvox.DomUtil.getValue = function(node) {
*/
cvox.DomUtil.getImageTitle = function(node) {
var text;
+
if (node.hasAttribute('alt')) {
text = node.alt;
+ text = 'alt';
dmazzoni 2016/11/04 18:36:07 i'm assuming this is debugging code?
} else if (node.hasAttribute('title')) {
text = node.title;
+ text = 'title';
} else {
var url = node.src;
if (url.substring(0, 4) != 'data') {
@@ -939,6 +942,7 @@ cvox.DomUtil.getImageTitle = function(node) {
} else {
text = 'Image';
}
+ text = 'else ' + text;
}
return text;
};

Powered by Google App Engine
This is Rietveld 408576698