PolymerElements / iron-overlay-behavior

Makes an element an overlay with an optional backdrop
41 stars 71 forks source link

Prevent open again when click on the trigger! #271

Closed AliMD closed 6 years ago

AliMD commented 6 years ago

In iron-dropdown element when user click on the trigger when the dropdown is open, dropdown close and after that it open again and use see a flash on dropdown-content

To prevent this we need to call cancel asynchronous to make a delay.

Before this PR I simply try to if (this.opened) return; in my trigger function but dropdown closed before trigger event then I forced to make this PR!

AliMD commented 6 years ago

Do you accept this solution? Or could you please help me to find a better one and pass the tests? Thank you in advance.

valdrinkoshi commented 6 years ago

Hi @AliMD, you can listen for iron-overlay-canceled event, and invoke event.preventDefault() to prevent the overlay from closing, e.g. see how <paper-menu-button> does it here: