Skip to content

Commit

Permalink
always listen for focus event on select
Browse files Browse the repository at this point in the history
  • Loading branch information
caseyjhol committed Jul 20, 2017
1 parent 2bc2581 commit 7e33113
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions js/bootstrap-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -364,10 +364,6 @@

if (typeof id !== 'undefined') {
this.$button.attr('data-id', id);
$('label[for="' + id + '"]').click(function (e) {
e.preventDefault();
that.$button.focus();
});
}

this.checkDisabled();
Expand Down Expand Up @@ -415,10 +411,6 @@
that.$button.addClass('bs-invalid');

that.$element.on({
'focus.bs.select': function () {
that.$button.focus();
that.$element.off('focus.bs.select');
},
'shown.bs.select': function () {
that.$element
.val(that.$element.val()) // set the value to hide the validation message in Chrome when menu is opened
Expand Down Expand Up @@ -1839,10 +1831,15 @@
}
});

this.$element.change(function () {
that.render();
that.$element.trigger('changed.bs.select', changed_arguments);
changed_arguments = null;
this.$element.on({
'change': function () {
that.render();
that.$element.trigger('changed.bs.select', changed_arguments);
changed_arguments = null;
},
'focus': function () {
that.$button.focus();
}
});
},

Expand Down

0 comments on commit 7e33113

Please sign in to comment.