Browse Source

Fixing bug with non-static parents for dropdowns

The offset of the parent was only being subtracted if the dropdown was
facing down, this now subtracts it if the dropdown is facing up as well.
This more or less applies the same fix as
https://github.com/select2/select2/commit/e260860789db87c68ed2889895c76a22e94dbce1,
but when calculating the position of the dropdown when it is facing up.

This closes https://github.com/select2/select2/issues/3303
This closes https://github.com/select2/select2/pull/4267
Ryan Cousart 9 years ago
parent
commit
ecdc416635
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/js/select2/dropdown/attachBody.js

+ 1 - 1
src/js/select2/dropdown/attachBody.js

@@ -182,7 +182,7 @@ define([
 
     if (newDirection == 'above' ||
       (isCurrentlyAbove && newDirection !== 'below')) {
-      css.top = container.top - dropdown.height;
+      css.top = container.top - parentOffset.top - dropdown.height;
     }
 
     if (newDirection != null) {