Dropdown multiple in same line collapse the same dropdown in diferent button
See original GitHub issuePrerequisites
- I have searched for duplicate or closed issues
- I have validated any HTML to avoid common problems
- I have read the contributing guidelines
Describe the issue
When two dropdowns are used in the same row, they do not work and both are not displayed, only the first one is displayed, the same happens even in the Bootstrap 5 documentation.
In the section Buttons with dropdowns
<div class="input-group">
<button class="btn btn-outline-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">Dropdown</button>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#">Action before</a></li>
<li><a class="dropdown-item" href="#">Another action before</a></li>
<li><a class="dropdown-item" href="#">Something else here</a></li>
<li><hr class="dropdown-divider"></li>
<li><a class="dropdown-item" href="#">Separated link</a></li>
</ul>
<input type="text" class="form-control" aria-label="Text input with 2 dropdown buttons">
<button class="btn btn-outline-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">Dropdown</button>
<ul class="dropdown-menu dropdown-menu-end">
<li><a class="dropdown-item" href="#">Action</a></li>
<li><a class="dropdown-item" href="#">Another action</a></li>
<li><a class="dropdown-item" href="#">Something else here</a></li>
<li><hr class="dropdown-divider"></li>
<li><a class="dropdown-item" href="#">Separated link</a></li>
</ul>
</div>
https://getbootstrap.com/docs/5.2/forms/input-group/
Reduced test cases
<div class="input-group">
<button class="btn btn-outline-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">Dropdown</button>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#">Action before</a></li>
<li><a class="dropdown-item" href="#">Another action before</a></li>
<li><a class="dropdown-item" href="#">Something else here</a></li>
<li><hr class="dropdown-divider"></li>
<li><a class="dropdown-item" href="#">Separated link</a></li>
</ul>
<input type="text" class="form-control" aria-label="Text input with 2 dropdown buttons">
<button class="btn btn-outline-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">Dropdown</button>
<ul class="dropdown-menu dropdown-menu-end">
<li><a class="dropdown-item" href="#">Action</a></li>
<li><a class="dropdown-item" href="#">Another action</a></li>
<li><a class="dropdown-item" href="#">Something else here</a></li>
<li><hr class="dropdown-divider"></li>
<li><a class="dropdown-item" href="#">Separated link</a></li>
</ul>
</div>
https://getbootstrap.com/docs/5.2/forms/input-group/
What operating system(s) are you seeing the problem on?
Linux
What browser(s) are you seeing the problem on?
Chrome
What version of Bootstrap are you using?
5.2.0
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Align bootstrap nav elements on the same line on collapse
When collapsed I want the text: This is a Button to next to the button “button1”. · If I manage to display them...
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 >Line-by-line: advanced CSS tricks for click-to-open drop-down ...
Preparing the initial appearance ... .combobox and .dropdown need to be relative so that the drop-down popup can be positioned relative to them....
Read more >Dropdown - Multiselect - Carbon Design System
Dropdowns present a list of options from which a user can select one option, or several. A selected option can represent a value...
Read more >How To Create a Cascading Dropdown - W3Schools
Create three dropdown lists, inside an HTML form. The second and third dropdown list will display different options, depending on the value selected...
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
Dropdown, by default , supports two elements (menu, toggle), inside a wrapper. So I suppose this can be solved using a wrapper (div) around each dropdown.
However, it seems was working on 5.1.3 & probably is caused by https://github.com/twbs/bootstrap/pull/35752/files (line 93) and (not preferable) I can add a PR fixing this back as a regression
@mdo I’m also disturbed by the result. I’ve created an example to illustrate what’s been said in the issue in https://stackblitz.com/edit/ybpfci?file=index.html.
Two different dropdowns are in the markup but only the first dropdown menu is displayed when triggered by the first and second dropdown buttons.