From 89d583736ab913356e9bfcacdd40066f227f2551 Mon Sep 17 00:00:00 2001 From: Barry Coughlan Date: Tue, 29 Jan 2013 18:45:33 +0000 Subject: [PATCH] Fix issue introduced by 20950e0f0cbbaa2ed9ddb3306320a69d4691c87d. Selected items and other invisible items were not ignored by highlightUnderEvent when calculating index. This caused highlighting of incorrect items when the list contained hidden items. --- select2.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/select2.js b/select2.js index 18a28d18..7792551b 100644 --- a/select2.js +++ b/select2.js @@ -1126,7 +1126,7 @@ the specific language governing permissions and limitations under the Apache Lic highlightUnderEvent: function (event) { var el = $(event.target).closest(".select2-result-selectable"); if (el.length > 0 && !el.is(".select2-highlighted")) { - var choices = this.results.find('.select2-result'); + var choices = this.results.find('.select2-result:visible'); this.highlight(choices.index(el)); } else if (el.length == 0) { // if we are over an unselectable item remove al highlights