How can I close opened dropdown?
See original GitHub issueI have this code:
{{#basic-dropdown disabled=(not selectedEvents.length) isOpen=eventsActionsIsOpen as |dropdown|}}
{{#dropdown.trigger}}
<button class="button margin-bottom-0" disabled={{not selectedEvents.length}}><i class="mdi mdi-dots-vertical"></i> Действия</button>
{{/dropdown.trigger}}
{{#dropdown.content}}
<ul class="dropdown menu vertical">
<li class="dropdown-item" {{action 'cancelEvents'}}>Отменить</li>
<li class="dropdown-item" {{action 'deleteEvents'}}>Удалить</li>
</ul>
{{/dropdown.content}}
{{/basic-dropdown}}
actions: {
cancelEvents() {
...
this.set('eventsActionsIsOpen', false);
}
}
But it don’t work. How can I close opened dropdown?
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
How to get the dropdown menu open / close when i click on its ...
You are doing a check on document click with each element with class='dropdown-menu' . So if(e.target !== $(this)) would always be true.
Read more >How do you close one dropdown menu when you open ...
addEventListener("click", event => { // start by closing every dropdown for (let dd of dropdown) dd.classList.toggle("open", false); ...
Read more >Opening a Select in a Dropdown closes the Dropdown
Actual behavior When clicking the SELECT it immediately closes the DROPDOWN. When the DROPDOWN is opened again the SELECT's option list is still...
Read more >Close dropdown menu when clicked outside of it using jquery
the dropdown menu is set not to be displayed by default with some css. lets open /close the dropdown using jquery. $(".dropdown").click(function(){.
Read more >Close dropdown menu - General - Forum | Webflow
Scroll up to the Timing header and click the checkbox to set as initial state. This will make sure the dropdown list is...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I had the same problem and solved it by using the close action of the public API of the dropdown object, similar to this:
@yvone-kioru Can you post your solution? I’m also trying to figure out how to create an external input trigger.