From: GeoSot Date: Thu, 8 Jul 2021 15:44:58 +0000 (+0300) Subject: make `dataApiKeydownHandler` to handle specific instance, avoiding extra manipulations X-Git-Tag: v5.1.0~53 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=e85a6ed77c92ee43cf23b5c6ce479dbd0100be66;p=thirdparty%2Fbootstrap.git make `dataApiKeydownHandler` to handle specific instance, avoiding extra manipulations --- diff --git a/js/src/dropdown.js b/js/src/dropdown.js index 60a27dbb0d..52c5339fae 100644 --- a/js/src/dropdown.js +++ b/js/src/dropdown.js @@ -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 }