1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-11 16:14:04 +02:00

Dropdown: merge instance identification in dataApiKeydownHandler

As we use the `dataApiKeydownHandler` only for events that are triggered on `[data-bs-toggle="dropdown"]` or on `.dropdown-menu`, we can ensure that their `parentNode` will ALWAYS be the `.dropdown` wrapper
This commit is contained in:
GeoSot
2022-01-30 23:50:22 +02:00
committed by XhmikosR
parent 22bbff0b03
commit d105439235
2 changed files with 21 additions and 1 deletions

View File

@@ -414,7 +414,7 @@ class Dropdown extends BaseComponent {
return
}
const getToggleButton = this.matches(SELECTOR_DATA_TOGGLE) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE)[0]
const getToggleButton = SelectorEngine.findOne(SELECTOR_DATA_TOGGLE, event.delegateTarget.parentNode)
const instance = Dropdown.getOrCreateInstance(getToggleButton)
if (isEscapeEvent) {