]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Dropdown: Clean more
authorGeoSot <geo.sotis@gmail.com>
Sun, 10 Oct 2021 13:47:02 +0000 (16:47 +0300)
committerXhmikosR <xhmikosr@gmail.com>
Wed, 1 Dec 2021 15:10:39 +0000 (17:10 +0200)
js/src/dropdown.js

index d5dfe2e20bab77fdf8fdda51f9f60752e4e8c921..510fcf1a406bd77f0b20fcebba820bde462827b1 100644 (file)
@@ -399,8 +399,7 @@ class Dropdown extends BaseComponent {
   static dataApiKeydownHandler(event) {
     // If not input/textarea:
     //  - And not a key in UP | DOWN | ESCAPE => not a dropdown command
-    // If input/textarea:
-    //  - If key is other than ESCAPE
+    // If input/textarea && If key is other than ESCAPE
     //    - If key is not UP or DOWN => not a dropdown command
     //    - If trigger inside the menu => not a dropdown command
 
@@ -412,9 +411,9 @@ class Dropdown extends BaseComponent {
       return
     }
 
-    if (isInput) {
+    if (isInput && !isEscapeEvent) {
       // eslint-disable-next-line unicorn/no-lonely-if
-      if (!isEscapeEvent && (!isUpOrDownEvent || event.target.closest(SELECTOR_MENU))) {
+      if (!isUpOrDownEvent || event.target.closest(SELECTOR_MENU)) {
         return
       }
     }