Browse Source

#4506 do not change selection when previously selected element is unfiltered

firstUnfiltered() forced change of selection even if previously selected element was visible. This meant that when tabbing through the field, the selected option was changed to first visible.
pull/4656/head
Codeborne 8 years ago
committed by Erik Jõgi, Patrick Abner
parent
commit
3fe5c551d3
1 changed files with 9 additions and 0 deletions
  1. 9
      src/definitions/modules/dropdown.js

9
src/definitions/modules/dropdown.js

@ -263,6 +263,15 @@ $.fn.dropdown = function(parameters) {
select: {
firstUnfiltered: function() {
module.verbose('Ensuring that an unfiltered option is selected');
var visibleExistingSelectedItem = $item.filter(
'.' + className.selected +
':not(.' + className.filtered + ')' +
':not(.' + className.disabled + ')');
if (visibleExistingSelectedItem.length) {
module.verbose('Previously selected element is unfiltered, not changing selection');
return;
}
module.verbose('Selecting first non-filtered element');
module.remove.selectedItem();
$item

Loading…
Cancel
Save