Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fixed bug with closeOnSelecet is false #541

Merged
merged 2 commits into from

2 participants

Brendan Heywood Igor Vaynberg
Brendan Heywood

When closeOnSelecet is false, with a multi select, each time you select an item the dropdown scrolls all the way back up to the top which makes quickly selecting a bunch of adjacent items slower.

Brendan Heywood

Oops - this breaks keyboard selection, I'll fix that.

Igor Vaynberg ivaynberg merged commit aa686aa into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 9 additions and 7 deletions.
  1. +9 −7 select2.js
16 select2.js
View
@@ -1088,7 +1088,7 @@ the specific language governing permissions and limitations under the Apache Lic
y = child.offset().top - results.offset().top;
// make sure the top of the element is visible
- if (y < 0) {
+ if (y < 0 && child.css('display') != 'none' ) {
results.scrollTop(results.scrollTop() + y); // y is negative
}
},
@@ -2166,12 +2166,14 @@ the specific language governing permissions and limitations under the Apache Lic
}
});
- choices.each2(function (i, choice) {
- if (!choice.hasClass("select2-disabled") && choice.hasClass("select2-result-selectable")) {
- self.highlight(0);
- return false;
- }
- });
+ if (this.highlight() == -1){
+ choices.each2(function (i, choice) {
+ if (!choice.hasClass("select2-disabled") && choice.hasClass("select2-result-selectable")) {
+ self.highlight(0);
+ return false;
+ }
+ });
+ }
},
Something went wrong with that request. Please try again.