diff --git a/demo/index.html b/demo/index.html
index 4bb258e..dcff4df 100644
--- a/demo/index.html
+++ b/demo/index.html
@@ -91,7 +91,7 @@
You can pre-select a value using the selected attribute
- You can change the direction in which the menu opens
+ You can change the direction in which the menu opens
diff --git a/paper-dropdown-menu.html b/paper-dropdown-menu.html
index d3c5c67..db0cd42 100644
--- a/paper-dropdown-menu.html
+++ b/paper-dropdown-menu.html
@@ -91,7 +91,7 @@
vertical-align="[[verticalAlign]]"
horizontal-align="[[horizontalAlign]]"
vertical-offset="[[_computeMenuVerticalOffset(noLabelFloat)]]"
- disabled="[[disabled]]"
+ disabled="[[_checkDisabled(disabled, readonly)]]"
no-animations="[[noAnimations]]"
on-iron-select="_onIronSelect"
on-iron-deselect="_onIronDeselect"
@@ -185,7 +185,7 @@
* The error message to display when invalid.
*/
errorMessage: {
- type: String
+ type: String
},
/**
@@ -242,6 +242,15 @@
verticalAlign: {
type: String,
value: 'top'
+ },
+
+ /**
+ * If you're using PaperInputBehavior to implement your own paper-input-like
+ * element, bind this to the ``'s `readonly` property.
+ */
+ readonly: {
+ type: Boolean,
+ observer: '_readonlyChanged'
}
},
@@ -286,7 +295,9 @@
* Show the dropdown content.
*/
open: function() {
- this.$.menuButton.open();
+ if (!this.readonly) {
+ this.$.menuButton.open();
+ }
},
/**
@@ -324,6 +335,16 @@
this.open();
}
},
+
+ /**
+ * Computed the disabled state for menu-button
+ *
+ * @param {disabled}
+ * @param {readonly}
+ */
+ _checkDisabled: function(disabled, readonly) {
+ return disabled || readonly;
+ },
/**
* Compute the label for the dropdown given a selected item.
@@ -375,6 +396,12 @@
if (e) {
e.setAttribute('aria-expanded', openState);
}
+ },
+
+ _readonlyChanged: function(readonly) {
+ if (readonly) {
+ this.close();
+ }
}
});
})();