Skip to content

Commit 472e5ad

Browse files
authored
Fix dropdown positioning when displayed above with messages (select2#5592)
This fixes an issue which was usually observed when working with AJAX results sets and having a message being displayed, usually the minimum characters message or an error. The dropdown would display up, like it was supposed to, but the message would appear to be floating above the container and detached. This was occuring because the dropdown position was not being calculated whenever a message was displayed in the results, only when the results were loaded or new results were appended to an existing results set. There are plenty of situations where this could have caused issues, but somehow most of the reports were around a very specific situation with AJAX which could be reproduced on the examples site. Fixes select2#4614 Fixes select2#4616 Fixes select2#5253 Closes select2#5196
1 parent 525f661 commit 472e5ad

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/js/select2/dropdown/attachBody.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ define([
3333
self._resizeDropdown();
3434
});
3535

36+
container.on('results:message', function () {
37+
self._positionDropdown();
38+
self._resizeDropdown();
39+
});
40+
3641
container.on('select', function () {
3742
self._positionDropdown();
3843
self._resizeDropdown();

0 commit comments

Comments
 (0)