mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-06 21:56:42 +02:00
fix(dropdowns): Fix multiple dropdowns when they are inside the same tag (#37011)
This commit is contained in:
committed by
GitHub
parent
54b4b2c66a
commit
337068f8b1
@@ -95,7 +95,8 @@ class Dropdown extends BaseComponent {
|
||||
|
||||
this._popper = null
|
||||
this._parent = this._element.parentNode // dropdown wrapper
|
||||
this._menu = SelectorEngine.findOne(SELECTOR_MENU, this._parent)
|
||||
// todo: v6 revert #37011 & change markup https://getbootstrap.com/docs/5.2/forms/input-group/
|
||||
this._menu = SelectorEngine.next(this._element, SELECTOR_MENU)[0] || SelectorEngine.prev(this._element, SELECTOR_MENU)[0]
|
||||
this._inNavbar = this._detectNavbar()
|
||||
}
|
||||
|
||||
@@ -405,7 +406,8 @@ class Dropdown extends BaseComponent {
|
||||
|
||||
event.preventDefault()
|
||||
|
||||
const getToggleButton = SelectorEngine.findOne(SELECTOR_DATA_TOGGLE, event.delegateTarget.parentNode)
|
||||
// todo: v6 revert #37011 & change markup https://getbootstrap.com/docs/5.2/forms/input-group/
|
||||
const getToggleButton = this.matches(SELECTOR_DATA_TOGGLE) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE)[0] || SelectorEngine.next(this, SELECTOR_DATA_TOGGLE)[0]
|
||||
const instance = Dropdown.getOrCreateInstance(getToggleButton)
|
||||
|
||||
if (isUpOrDownEvent) {
|
||||
|
Reference in New Issue
Block a user