Skip to content

Commit 20beb5f

Browse files
fabienwnklrrisadams
authored andcommitted
fix : dropdown width auto_position
1 parent 357678c commit 20beb5f

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/plugins/auto_position/plugin.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ Selectize.define("auto_position", function () {
2121
controlPosBottom - dropdownHeight - wrapperHeight >= 0 ?
2222
POSITION.top :
2323
POSITION.bottom;
24+
const w = this.$wrapper[0].style.width !== 'fit-content' ? '100%' : 'max-content';
2425
const styles = {
25-
width: $control.outerWidth(),
26+
width: w,
2627
left: offset.left
2728
};
2829

@@ -43,6 +44,12 @@ Selectize.define("auto_position", function () {
4344
}
4445

4546
this.$dropdown.css(styles);
47+
48+
if (w === 'max-content' && $control[0].getBoundingClientRect().width >= this.$dropdown[0].getBoundingClientRect().width) {
49+
this.$dropdown.css({
50+
width : '100%'
51+
});
52+
}
4653
};
4754
}());
4855
});

0 commit comments

Comments
 (0)