mirror of
https://github.com/twbs/bootstrap.git
synced 2022-11-09 12:25:43 -05:00
make dataApiKeydownHandler
to handle specific instance, avoiding extra manipulations
This commit is contained in:
parent
9916191311
commit
e85a6ed77c
1 changed files with 5 additions and 5 deletions
|
@ -449,20 +449,20 @@ class Dropdown extends BaseComponent {
|
|||
return
|
||||
}
|
||||
|
||||
const getToggleButton = () => this.matches(SELECTOR_DATA_TOGGLE) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE)[0]
|
||||
const getToggleButton = this.matches(SELECTOR_DATA_TOGGLE) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE)[0]
|
||||
const instance = Dropdown.getOrCreateInstance(getToggleButton)
|
||||
|
||||
if (event.key === ESCAPE_KEY) {
|
||||
getToggleButton().focus()
|
||||
Dropdown.clearMenus()
|
||||
instance.hide()
|
||||
return
|
||||
}
|
||||
|
||||
if (event.key === ARROW_UP_KEY || event.key === ARROW_DOWN_KEY) {
|
||||
if (!isActive) {
|
||||
getToggleButton().click()
|
||||
instance.show()
|
||||
}
|
||||
|
||||
Dropdown.getInstance(getToggleButton())._selectMenuItem(event)
|
||||
instance._selectMenuItem(event)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue