Skip to content

Commit

Permalink
Semantic-Org#4506 do not change selection when previously selected el…
Browse files Browse the repository at this point in the history
…ement 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.
  • Loading branch information
cbxp authored and Erik Jõgi, Patrick Abner committed Oct 17, 2016
1 parent 57e7199 commit 3fe5c55
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/definitions/modules/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3fe5c55

Please sign in to comment.