Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v5: Dropdown - create a class/data-attribute selector to prevent closing dropdown-menu on click #32723

Closed
jakubmuda opened this issue Jan 7, 2021 · 0 comments · Fixed by #33389

Comments

@jakubmuda
Copy link

jakubmuda commented Jan 7, 2021

By default .dropdown-menu hides when you click inside it. The only exception is when you have a form - it stays open when you focus on input or click buttons. It would be good to have a dedicated class .dropdown-menu-something or data attribute data-something="something" to prevent .dropdown-menu from hiding for content other than forms.

<ul class="dropdown-menu dropdown-menu-something" aria-labelledby="dropdownMenuButton">

OR

<ul class="dropdown-menu" data-something="something" aria-labelledby="dropdownMenuButton">

It looks like the javascript for preventing such behaviour in forms is very simple so why not add another selector?
Line 634: https://github.com/twbs/bootstrap/blob/main/js/dist/dropdown.js#L634

@mdo mdo added the js label Jan 7, 2021
@jakubmuda jakubmuda changed the title Dropdown - create a class selector to prevent closing dropdown-menu on click v5: Dropdown - create a class/data-attribute selector to prevent closing dropdown-menu on click Jan 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants