소스 검색

Fix `dropdownAutoWidth` so it actually works

Previously the `dropdownAutoWidth` option didn't work because the
dropdown was being absolutely positioned, so setting the width to
`auto` didn't actually have an effect. This cannot be solved by
just setting the width on the container, because that is also
absolutely positioned.

This closes https://github.com/select2/select2/issues/3101
Kevin Brown 9 년 전
부모
커밋
fe26b083eb
1개의 변경된 파일1개의 추가작업 그리고 0개의 파일을 삭제
  1. 1 0
      src/js/select2/dropdown/attachBody.js

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

@@ -204,6 +204,7 @@ define([
 
     if (this.options.get('dropdownAutoWidth')) {
       css.minWidth = css.width;
+      css.position = 'relative';
       css.width = 'auto';
     }