1
0
mirror of synced 2024-12-01 17:16:02 +03:00

Resize search after removing a choice

This fixes a previous bug with the backspace handler on the multiple
select search box where unselecting a choice through the keyboard would
not properly size the search box. As a result, most of the text would be
cut off and it was very clear that there was an issue.

In addition, a blank space was automatically being added to the end of
the search query. This blank space would not be removed at all, so the
user had to manually remove it.

Additionally, a query would be triggered for the last used search term
instead of the new search term that would be loaded in. This caused
incorrect results to be displayed most of the time.

All of these issues have been fixed by triggering a new search query
after an option has been removed through the keyboard. This will resize
the search box automatically, which fixes the main issue, and it will
trigger a search with the correct query.

This closes https://github.com/select2/select2/issues/3297
This closes https://github.com/select2/select2/pull/3398
This commit is contained in:
Kevin Brown 2015-11-23 18:22:33 -05:00
parent 8763a87779
commit 5f80c5d9f8

View File

@ -193,9 +193,8 @@ define([
data: item data: item
}); });
this.trigger('open', {}); this.$search.val(item.text);
this.handleSearch();
this.$search.val(item.text + ' ');
}; };
Search.prototype.resizeSearch = function () { Search.prototype.resizeSearch = function () {