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

Unified Diff: chrome/browser/resources/settings/controls/controlled_radio_button.js

Issue 2815593002: MD Settings: circumvent problems with shadow DOM and aria radio* roles (Closed)
Patch Set: Created 3 years, 8 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/controls/controlled_radio_button.js
diff --git a/chrome/browser/resources/settings/controls/controlled_radio_button.js b/chrome/browser/resources/settings/controls/controlled_radio_button.js
index 13a021fa93deee4d72395a8993902a75b179fab4..d7b4933e4066a324ee99faefa035445211dc7f3d 100644
--- a/chrome/browser/resources/settings/controls/controlled_radio_button.js
+++ b/chrome/browser/resources/settings/controls/controlled_radio_button.js
@@ -8,7 +8,10 @@ Polymer({
behaviors: [PrefControlBehavior],
properties: {
- label: String,
+ label: {
+ type: String,
+ observer: 'labelChanged_',
+ },
name: {
type: String,
@@ -23,6 +26,12 @@ Polymer({
},
},
+ hostAttributes: {
+ // NOTE(dbeam): this should not be necessary but currently radiogroup and
+ // radio roles don't work across shadow DOM boundaries.
+ role: 'radio',
+ },
+
listeners: {
'focus': 'onFocus_',
},
@@ -35,6 +44,14 @@ Polymer({
return this.pref.enforcement == chrome.settingsPrivate.Enforcement.ENFORCED;
},
+ /** @private */
+ labelChanged_: function() {
+ if (this.label)
+ this.setAttribute('aria-label', this.label);
+ else
+ this.removeAttribute('aria-label');
hcarmona 2017/04/11 17:47:25 There's only one case where label isn't set. http
+ },
+
/**
* @param {boolean} controlled
* @param {string} name

Powered by Google App Engine
This is Rietveld 408576698