Add data-bs-dismiss="dropdown" to close dropdown on button click
See original GitHub issueWe have similar options for modal, offcanvas and alert, where components can be dismissed on button click. But there’s no way to close dropdown menu with data-bs-auto-close="inside"
from the dropdown itself. A simple example would be individual action button like Apply or Close/Cancel in dropdown with a form - user can fill out the form and click Apply to submit the form and close the menu. In that scenario, having an option to dismiss the menu by clicking the button that has data-bs-dismiss="dropdown"
would be super handy.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:4
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Close Bootstrap Dropdown after link click - Stack Overflow
the best answer will be is to perform click so it will act the same as the user click the mouse to hide...
Read more >Dropdowns - Bootstrap
Dropdowns are toggleable, contextual overlays for displaying lists of links and more. They're made interactive with the included Bootstrap dropdown ...
Read more >Bootstrap JS Dropdown Reference - W3Schools
Add data -toggle="dropdown" to a link or a button to toggle a dropdown menu. ... hide.bs.dropdown, Occurs when the dropdown is about to...
Read more >How to avoid dropdown menu to close menu items on clicking ...
The default behavior of a dropdown menu is to close the menu list items when clicked inside. In this article, We will use...
Read more >Hide Dropdown via js - Material Design for Bootstrap
$(function () { $(".dropdown-menu > li a").click(function () { console.log("clicked"); return false; }); });
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
Well, closing modals and alerts can be also achieved via a small script, but we have data-dismiss thing for some reason. Why don’t we have it also for dropdowns? 😁
Closing as a won’t fix. If folks have suggestions for demos and snippets to add to the docs to show this though, we’d be happy to review and merge.