Skip to content

Commit

Permalink
issue/2464 Automatically focus on first item (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverfoster authored Jun 22, 2021
1 parent 949a7e2 commit 31715ab
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion js/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ define([
getFirstSelectedItem: function() {
return _.find(this.options, function(option) {
return option.isSelected();
});
}) || this.options[0];
},

setActiveDescendantId: function(id) {
Expand Down
5 changes: 5 additions & 0 deletions js/matchingModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ define([

setOptionSelected: function(itemIndex, optionIndex, isSelected) {
var item = this.get('_items')[itemIndex];
if (isNaN(optionIndex)) {
item._options.forEach(option => option._isSelected = false);
item._selected = null;
return this.checkCanSubmit();
}
var option = _.findWhere(item._options, { '_index': optionIndex });
option._isSelected = isSelected;
item._selected = option;
Expand Down

0 comments on commit 31715ab

Please sign in to comment.