diff --git a/core-dropdown-base.html b/core-dropdown-base.html index f54abd4..508a6fa 100644 --- a/core-dropdown-base.html +++ b/core-dropdown-base.html @@ -41,6 +41,18 @@ }, + + /** + * This specifies the name of the attribute that can be set on + * elements within the dropdown to prevent them from closing the + * dropdown on tap. + * + * @attribute dropdownKeepAttribute + * @type string + * @default 'core-dropdown-keep' + */ + dropdownKeepAttribute: 'core-dropdown-keep', + eventDelegates: { 'tap': 'toggleOverlay' }, @@ -107,7 +119,13 @@ this.opened = !!e.detail; }, - toggleOverlay: function() { + toggleOverlay: function(e) { + if (this.opened && + this.dropdownKeepAttribute && + e.target && e.target.hasAttribute(this.dropdownKeepAttribute)) + { + return; + } this.opened = !this.opened; }