Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

Commit bd32efe

Browse files
author
Brian Feister
committed
Merge pull request #638 from JeromeLam/issue/#624
Issue/#624 - Add extra handling for negative activeIndex.
2 parents 28466ab + 514940b commit bd32efe

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/select.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@
551551
break;
552552
case KEY.UP:
553553
if (!ctrl.open && ctrl.multiple) ctrl.activate(false, true); //In case its the search input in 'multiple' mode
554-
else if (ctrl.activeIndex > 0 || (ctrl.search.length === 0 && ctrl.tagging.isActivated)) { ctrl.activeIndex--; }
554+
else if (ctrl.activeIndex > 0 || (ctrl.search.length === 0 && ctrl.tagging.isActivated && ctrl.activeIndex > -1)) { ctrl.activeIndex--; }
555555
break;
556556
case KEY.TAB:
557557
if (!ctrl.multiple || ctrl.open) ctrl.select(ctrl.items[ctrl.activeIndex], true);
@@ -853,6 +853,10 @@
853853
throw uiSelectMinErr('choices', "Expected multiple .ui-select-choices-row but got '{0}'.", choices.length);
854854
}
855855

856+
if (ctrl.activeIndex < 0) {
857+
return;
858+
}
859+
856860
var highlighted = choices[ctrl.activeIndex];
857861
var posY = highlighted.offsetTop + highlighted.clientHeight - container[0].scrollTop;
858862
var height = container[0].offsetHeight;
@@ -1329,4 +1333,3 @@
13291333
};
13301334
});
13311335
}());
1332-

0 commit comments

Comments
 (0)