Browse Source

HUE-8288 [assist] Prevent cursor movement on up and down keypress when the filter autocomplete is open

Johan Ahlen 7 years ago
parent
commit
da1cb14c29

+ 7 - 0
desktop/core/src/desktop/templates/ko_components/ko_drop_down.mako

@@ -134,8 +134,15 @@ from desktop.views import _ko
           var visibleSub = dropDownVisible.subscribe(function (newValue) {
             if (newValue) {
               $(keyUpTarget).on('keyup.hueDropDown', keyUp);
+              $(keyUpTarget).on('keydown.hueDropDown', function (e) {
+                // This prevents the cursor from moving left or right on up and down
+                if (e.keyCode === 38 || e.keyCode === 40) {
+                  e.preventDefault();
+                }
+              })
             } else {
               $(keyUpTarget).off('keyup.hueDropDown');
+              $(keyUpTarget).off('keydown.hueDropDown');
             }
           });