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

Unified Diff: third_party/polymer/v1_0/components-chromium/paper-radio-group/paper-radio-group-extracted.js

Issue 1984963002: Roll Polymer elements (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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: third_party/polymer/v1_0/components-chromium/paper-radio-group/paper-radio-group-extracted.js
diff --git a/third_party/polymer/v1_0/components-chromium/paper-radio-group/paper-radio-group-extracted.js b/third_party/polymer/v1_0/components-chromium/paper-radio-group/paper-radio-group-extracted.js
index 430641078e38bbed5b39d916f68408c3c8a1f721..642f8ec5a6983b1fc01e1b3658ba205dcfb2e9d1 100644
--- a/third_party/polymer/v1_0/components-chromium/paper-radio-group/paper-radio-group-extracted.js
+++ b/third_party/polymer/v1_0/components-chromium/paper-radio-group/paper-radio-group-extracted.js
@@ -2,8 +2,7 @@ Polymer({
is: 'paper-radio-group',
behaviors: [
- Polymer.IronA11yKeysBehavior,
- Polymer.IronSelectableBehavior
+ Polymer.IronMenubarBehavior
],
hostAttributes: {
@@ -51,15 +50,15 @@ Polymer({
}
},
- keyBindings: {
- 'left up': 'selectPrevious',
- 'right down': 'selectNext',
- },
-
/**
* Selects the given value.
*/
select: function(value) {
+ var newItem = this._valueToItem(value);
+ if (newItem && newItem.hasAttribute('disabled')) {
+ return;
+ }
+
if (this.selected) {
var oldItem = this._valueToItem(this.selected);
@@ -84,33 +83,29 @@ Polymer({
this.fire('paper-radio-group-changed');
},
- /**
- * Selects the previous item. If the previous item is disabled, then it is
- * skipped, and its previous item is selected
- */
- selectPrevious: function() {
- var length = this.items.length;
- var newIndex = Number(this._valueToIndex(this.selected));
-
- do {
- newIndex = (newIndex - 1 + length) % length;
- } while (this.items[newIndex].disabled)
-
- this._itemActivate(this._indexToValue(newIndex), this.items[newIndex]);
+ _activateFocusedItem: function() {
+ this._itemActivate(this._valueForItem(this.focusedItem), this.focusedItem);
},
- /**
- * Selects the next item. If the next item is disabled, then it is
- * skipped, and the next item after it is selected.
- */
- selectNext: function() {
- var length = this.items.length;
- var newIndex = Number(this._valueToIndex(this.selected));
+ _onUpKey: function(event) {
+ this._focusPrevious();
+ event.preventDefault();
+ this._activateFocusedItem();
+ },
- do {
- newIndex = (newIndex + 1 + length) % length;
- } while (this.items[newIndex].disabled)
+ _onDownKey: function(event) {
+ this._focusNext();
+ event.preventDefault();
+ this._activateFocusedItem();
+ },
- this._itemActivate(this._indexToValue(newIndex), this.items[newIndex]);
+ _onLeftKey: function(event) {
+ Polymer.IronMenubarBehaviorImpl._onLeftKey.apply(this, arguments);
+ this._activateFocusedItem();
},
+
+ _onRightKey: function(event) {
+ Polymer.IronMenubarBehaviorImpl._onRightKey.apply(this, arguments);
+ this._activateFocusedItem();
+ }
});

Powered by Google App Engine
This is Rietveld 408576698