Index: ui/login/account_picker/user_pod_row.js |
diff --git a/ui/login/account_picker/user_pod_row.js b/ui/login/account_picker/user_pod_row.js |
index 96d678fb986a76dc090137788220cff98947ccd0..dbac7f3deafd7ca5546ca69ac05587e41b7cf7d0 100644 |
--- a/ui/login/account_picker/user_pod_row.js |
+++ b/ui/login/account_picker/user_pod_row.js |
@@ -292,6 +292,14 @@ cr.define('login', function() { |
}, |
/** |
+ * Sets the ARIA label for the icon. |
+ * @param {!string} ariaLabel |
+ */ |
+ setAriaLabel: function(ariaLabel) { |
+ this.iconElement.setAttribute('aria-label', ariaLabel); |
+ }, |
+ |
+ /** |
* Shows the icon. |
*/ |
show: function() { |
@@ -352,9 +360,6 @@ cr.define('login', function() { |
} |
this.hideTooltip_(true); |
- |
- if (this.tooltip_) |
- this.iconElement.setAttribute('aria-lablel', this.tooltip_); |
}, |
/** |
@@ -496,7 +501,6 @@ cr.define('login', function() { |
return; |
$('bubble').hideForElement(this); |
this.tooltipAutoshown_ = false; |
- this.iconElement.removeAttribute('aria-label'); |
}, |
/** |
@@ -2246,6 +2250,7 @@ cr.define('login', function() { |
* @param {string} username Username of pod to add button |
* @param {!{id: !string, |
* hardlockOnClick: boolean, |
+ * ariaLabel: string | undefined, |
* tooltip: ({text: string, autoshow: boolean} | undefined)}} icon |
* The icon parameters. |
*/ |
@@ -2269,6 +2274,12 @@ cr.define('login', function() { |
pod.customIconElement.setInteractive(null); |
} |
+ var ariaLabel = icon.ariaLabel || (icon.tooltip && icon.tooltip.text); |
+ if (ariaLabel) |
+ pod.customIconElement.setAriaLabel(ariaLabel); |
+ else |
+ console.warn('No ARIA label for user pod custom icon.'); |
+ |
pod.customIconElement.show(); |
// This has to be called after |show| in case the tooltip should be shown |