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

Side by Side Diff: chrome/browser/resources/settings/controls/settings_radio_group.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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview 6 * @fileoverview
7 * `cr-radio-group` wraps a radio-group and set of radio-buttons that control 7 * `cr-radio-group` wraps a radio-group and set of radio-buttons that control
8 * a supplied preference. 8 * a supplied preference.
9 * 9 *
10 * Example: 10 * Example:
(...skipping 10 matching lines...) Expand all
21 /** 21 /**
22 * IronSelectableBehavior selected attribute. 22 * IronSelectableBehavior selected attribute.
23 */ 23 */
24 selected: { 24 selected: {
25 type: String, 25 type: String,
26 notify: true, 26 notify: true,
27 observer: 'selectedChanged_' 27 observer: 'selectedChanged_'
28 }, 28 },
29 }, 29 },
30 30
31 hostAttributes: {
32 // NOTE(dbeam): this should not be necessary, but radiogroup and radio must
33 // be in the same shadow tree, which is not guaranteed so we duplicate roles
34 // of this :host and the *-radio-buttons selected by this template's
35 // <content> tag.
36 role: 'radiogroup',
hcarmona 2017/04/11 17:47:25 Is this needed? The radio buttons are already chil
37 },
38
31 observers: [ 39 observers: [
32 'prefChanged_(pref.*)', 40 'prefChanged_(pref.*)',
33 ], 41 ],
34 42
35 /** @private */ 43 /** @private */
36 prefChanged_: function() { 44 prefChanged_: function() {
37 var pref = /** @type {!chrome.settingsPrivate.PrefObject} */(this.pref); 45 var pref = /** @type {!chrome.settingsPrivate.PrefObject} */(this.pref);
38 this.selected = Settings.PrefUtil.prefToString(pref); 46 this.selected = Settings.PrefUtil.prefToString(pref);
39 }, 47 },
40 48
41 /** @private */ 49 /** @private */
42 selectedChanged_: function(selected) { 50 selectedChanged_: function(selected) {
43 if (!this.pref) 51 if (!this.pref)
44 return; 52 return;
45 this.set('pref.value', 53 this.set('pref.value',
46 Settings.PrefUtil.stringToPrefValue(selected, this.pref)); 54 Settings.PrefUtil.stringToPrefValue(selected, this.pref));
47 }, 55 },
48 }); 56 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698