Change how the results are highlighted
Previously, a result was no longer highlighted when the mouse was no longer over it. While this was useful for resetting the highlight automatically, we started doing this when a new result was highlighted to make sure that we never had multiple options highlighted. Now, a result will always be highlighted until the highlight is removed when the next result is highlighted. While this shouldn't affect many users, it is closer to how native select boxes work. This also allows users using keyboard navigation to jump between mouse and keyboard navigation without the highlight reseting to the top of the results.
This commit is contained in:
parent
849a9c7a32
commit
cee8c18c23
7
dist/js/select2.amd.full.js
vendored
7
dist/js/select2.amd.full.js
vendored
@ -511,13 +511,6 @@ define('select2/results',[
|
|||||||
element: $(this)
|
element: $(this)
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
this.$results.on('mouseleave', '.option', function (evt) {
|
|
||||||
if ($(this).hasClass('highlighted')) {
|
|
||||||
$(this).removeClass('highlighted');
|
|
||||||
self.$results.removeAttr('aria-activedescendant');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Results.prototype.destroy = function () {
|
Results.prototype.destroy = function () {
|
||||||
|
7
dist/js/select2.amd.js
vendored
7
dist/js/select2.amd.js
vendored
@ -511,13 +511,6 @@ define('select2/results',[
|
|||||||
element: $(this)
|
element: $(this)
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
this.$results.on('mouseleave', '.option', function (evt) {
|
|
||||||
if ($(this).hasClass('highlighted')) {
|
|
||||||
$(this).removeClass('highlighted');
|
|
||||||
self.$results.removeAttr('aria-activedescendant');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Results.prototype.destroy = function () {
|
Results.prototype.destroy = function () {
|
||||||
|
7
dist/js/select2.full.js
vendored
7
dist/js/select2.full.js
vendored
@ -10046,13 +10046,6 @@ define('select2/results',[
|
|||||||
element: $(this)
|
element: $(this)
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
this.$results.on('mouseleave', '.option', function (evt) {
|
|
||||||
if ($(this).hasClass('highlighted')) {
|
|
||||||
$(this).removeClass('highlighted');
|
|
||||||
self.$results.removeAttr('aria-activedescendant');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Results.prototype.destroy = function () {
|
Results.prototype.destroy = function () {
|
||||||
|
4
dist/js/select2.full.min.js
vendored
4
dist/js/select2.full.min.js
vendored
File diff suppressed because one or more lines are too long
7
dist/js/select2.js
vendored
7
dist/js/select2.js
vendored
@ -939,13 +939,6 @@ define('select2/results',[
|
|||||||
element: $(this)
|
element: $(this)
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
this.$results.on('mouseleave', '.option', function (evt) {
|
|
||||||
if ($(this).hasClass('highlighted')) {
|
|
||||||
$(this).removeClass('highlighted');
|
|
||||||
self.$results.removeAttr('aria-activedescendant');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Results.prototype.destroy = function () {
|
Results.prototype.destroy = function () {
|
||||||
|
2
dist/js/select2.min.js
vendored
2
dist/js/select2.min.js
vendored
File diff suppressed because one or more lines are too long
7
src/js/select2/results.js
vendored
7
src/js/select2/results.js
vendored
@ -357,13 +357,6 @@ define([
|
|||||||
element: $(this)
|
element: $(this)
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
this.$results.on('mouseleave', '.option', function (evt) {
|
|
||||||
if ($(this).hasClass('highlighted')) {
|
|
||||||
$(this).removeClass('highlighted');
|
|
||||||
self.$results.removeAttr('aria-activedescendant');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Results.prototype.destroy = function () {
|
Results.prototype.destroy = function () {
|
||||||
|
Loading…
Reference in New Issue
Block a user