Skip to content

Commit aa686aa

Browse files
committed
Merge pull request select2#541 from brendanheywood/master
Fixed bug with closeOnSelecet is false
2 parents d926d47 + 6c59b1e commit aa686aa

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

select2.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,7 +1088,7 @@ the specific language governing permissions and limitations under the Apache Lic
10881088
y = child.offset().top - results.offset().top;
10891089

10901090
// make sure the top of the element is visible
1091-
if (y < 0) {
1091+
if (y < 0 && child.css('display') != 'none' ) {
10921092
results.scrollTop(results.scrollTop() + y); // y is negative
10931093
}
10941094
},
@@ -2166,12 +2166,14 @@ the specific language governing permissions and limitations under the Apache Lic
21662166
}
21672167
});
21682168

2169-
choices.each2(function (i, choice) {
2170-
if (!choice.hasClass("select2-disabled") && choice.hasClass("select2-result-selectable")) {
2171-
self.highlight(0);
2172-
return false;
2173-
}
2174-
});
2169+
if (this.highlight() == -1){
2170+
choices.each2(function (i, choice) {
2171+
if (!choice.hasClass("select2-disabled") && choice.hasClass("select2-result-selectable")) {
2172+
self.highlight(0);
2173+
return false;
2174+
}
2175+
});
2176+
}
21752177

21762178
},
21772179

0 commit comments

Comments
 (0)