From 9d6cd8bd0343283498ad0e9570bb8b350d9b305d Mon Sep 17 00:00:00 2001 From: Jerome Lam Date: Fri, 6 Feb 2015 10:16:02 -0500 Subject: [PATCH 1/2] Add missing negative activeIndex check just like in select2.js. --- src/select.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/select.js b/src/select.js index 2196f2646..923c07dd0 100644 --- a/src/select.js +++ b/src/select.js @@ -853,6 +853,10 @@ throw uiSelectMinErr('choices', "Expected multiple .ui-select-choices-row but got '{0}'.", choices.length); } + if (ctrl.activeIndex < 0) { + return; + } + var highlighted = choices[ctrl.activeIndex]; var posY = highlighted.offsetTop + highlighted.clientHeight - container[0].scrollTop; var height = container[0].offsetHeight; @@ -1329,4 +1333,3 @@ }; }); }()); - From 514940ba7bbc2b2c4ecf4d2f405c1c886a87ece0 Mon Sep 17 00:00:00 2001 From: Jerome Lam Date: Fri, 6 Feb 2015 10:16:23 -0500 Subject: [PATCH 2/2] Cap activeIndex's minimum to -1. --- src/select.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/select.js b/src/select.js index 923c07dd0..3ba423e64 100644 --- a/src/select.js +++ b/src/select.js @@ -551,7 +551,7 @@ break; case KEY.UP: if (!ctrl.open && ctrl.multiple) ctrl.activate(false, true); //In case its the search input in 'multiple' mode - else if (ctrl.activeIndex > 0 || (ctrl.search.length === 0 && ctrl.tagging.isActivated)) { ctrl.activeIndex--; } + else if (ctrl.activeIndex > 0 || (ctrl.search.length === 0 && ctrl.tagging.isActivated && ctrl.activeIndex > -1)) { ctrl.activeIndex--; } break; case KEY.TAB: if (!ctrl.multiple || ctrl.open) ctrl.select(ctrl.items[ctrl.activeIndex], true);