1
0
mirror of synced 2024-11-22 04:56:08 +03:00

Renamed focusFirstItem method

This renames the `focusFirstItem` method to `highlightFirstItem`, which
better reflects what is actually happening. This also ensures that the
highlight is visible when it is moved by calling
`ensureHighlightVisible`.

This closes https://github.com/select2/select2/issues/3479
This closes https://github.com/select2/select2/pull/4238
This commit is contained in:
Kevin Brown 2016-05-14 21:02:44 -04:00
parent e897d008a6
commit 9f581285d8

View File

@ -97,8 +97,7 @@ define([
return sorter(data);
};
Results.prototype.focusFirstItem = function () {
Results.prototype.highlightFirstItem = function () {
var $options = this.$results
.find('.select2-results__option[aria-selected]');
@ -114,6 +113,7 @@ define([
$options.first().trigger('mouseenter');
}
this.ensureHighlightVisible();
};
Results.prototype.setClasses = function () {
@ -253,7 +253,7 @@ define([
if (container.isOpen()) {
self.setClasses();
self.focusFirstItem();
self.highlightFirstItem();
}
});
@ -276,7 +276,7 @@ define([
}
self.setClasses();
self.focusFirstItem();
self.highlightFirstItem();
});
container.on('unselect', function () {
@ -285,7 +285,7 @@ define([
}
self.setClasses();
self.focusFirstItem();
self.highlightFirstItem();
});
container.on('open', function () {