Skip to content

Commit

Permalink
Add flagg to disableOnFocusHandling on paper-input-container
Browse files Browse the repository at this point in the history
  • Loading branch information
acory committed Oct 30, 2017
1 parent fe87397 commit 848ae7e
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ dropdown options have.
* value - String
* avoidHeaderOverlappingDropdown - Boolean , default: false . This was added for a case in pmp, where when the dropdown
oppened upwards, the search input was covered by the header of the app
* disableOnFocusHandling - Boolean, default: false. Set to true to disable onFocus handling on the dropdown (more specifically the contained paper-input-container). We set this to true when the dropdown is in a modal, to avoid a bug that consists of the dropdown overlay closing and opening again and remaining opened , when clicking outside the dropdown or after selecting an item
## Usage

Examples:
Expand Down
13 changes: 12 additions & 1 deletion behaviors/common-behavior.html
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@
_resizedManually: {
type: Boolean,
value: false
},
disableOnFocusHandling: {
type: Boolean,
value: false,
reflectToAttribute: true
}
},
listeners: {
Expand Down Expand Up @@ -271,7 +276,13 @@
var ddContent = this._getDropdownContent();
ddContent.style.height = 'auto';
this.notifyDropdownResize();
}
},
_onFocusInputContainer: function() {
if (this.disableOnFocusHandling) {
return;
}
this._openMenu();
},

};
</script>
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "etools-searchable-multiselection-menu",
"description": "Dropdown menu with search and multiple options selection",
"version": "2.2.8",
"version": "2.2.9",
"license": "https://github.com/unicef-polymer/etools-searchable-multiselection-menu/blob/master/LICENSE.md",
"main": "etools-searchable-multiselection-menu.html",
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion etools-multi-selection-menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
invalid$="[[invalid]]"
required$="[[required]]"
attr-for-value="selected-values"
on-focus="_openMenu"
on-focus="_onFocusInputContainer"
on-tap="_handleClickOrTap"
on-click="_handleClickOrTap">

Expand Down
3 changes: 2 additions & 1 deletion etools-single-selection-menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
disabled$="[[disabled]]"
invalid$="[[invalid]]"
no-label-float="[[noLabelFloat]]"
on-focus="_openMenu"
on-focus="_onFocusInputContainer"
on-tap="_handleClickOrTap"
on-click="_handleClickOrTap">

Expand Down Expand Up @@ -197,6 +197,7 @@
e.stopImmediatePropagation();
this._openMenu(e);
},

_openMenu: function(e) {
var dropdown = this.$.dropdownMenu;
if (!dropdown.opened) {
Expand Down

0 comments on commit 848ae7e

Please sign in to comment.