Skip to content

Commit

Permalink
Renamed focusFirstItem method
Browse files Browse the repository at this point in the history
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 #3479
This closes #4238
  • Loading branch information
kevin-brown committed May 15, 2016
1 parent e897d00 commit 9f58128
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/js/select2/results.js
Expand Up @@ -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]');

Expand All @@ -114,6 +113,7 @@ define([
$options.first().trigger('mouseenter');
}

this.ensureHighlightVisible();
};

Results.prototype.setClasses = function () {
Expand Down Expand Up @@ -253,7 +253,7 @@ define([

if (container.isOpen()) {
self.setClasses();
self.focusFirstItem();
self.highlightFirstItem();
}
});

Expand All @@ -276,7 +276,7 @@ define([
}

self.setClasses();
self.focusFirstItem();
self.highlightFirstItem();
});

container.on('unselect', function () {
Expand All @@ -285,7 +285,7 @@ define([
}

self.setClasses();
self.focusFirstItem();
self.highlightFirstItem();
});

container.on('open', function () {
Expand Down

0 comments on commit 9f58128

Please sign in to comment.