소스 검색

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 년 전
부모
커밋
ecdc416635
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  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) {