Skip to content

Commit

Permalink
Fix dropdown positioning when displayed above with messages (#5592)
Browse files Browse the repository at this point in the history
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 #4614
Fixes #4616
Fixes #5253
Closes #5196
  • Loading branch information
kevin-brown committed Jul 28, 2019
1 parent 525f661 commit 472e5ad
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/js/select2/dropdown/attachBody.js
Expand Up @@ -33,6 +33,11 @@ define([
self._resizeDropdown();
});

container.on('results:message', function () {
self._positionDropdown();
self._resizeDropdown();
});

container.on('select', function () {
self._positionDropdown();
self._resizeDropdown();
Expand Down

0 comments on commit 472e5ad

Please sign in to comment.