Skip to content

Commit

Permalink
fix : dropdown width auto_position
Browse files Browse the repository at this point in the history
  • Loading branch information
fabienwnklr authored and risadams committed Dec 23, 2022
1 parent 357678c commit 20beb5f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/plugins/auto_position/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ Selectize.define("auto_position", function () {
controlPosBottom - dropdownHeight - wrapperHeight >= 0 ?
POSITION.top :
POSITION.bottom;
const w = this.$wrapper[0].style.width !== 'fit-content' ? '100%' : 'max-content';
const styles = {
width: $control.outerWidth(),
width: w,
left: offset.left
};

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

this.$dropdown.css(styles);

if (w === 'max-content' && $control[0].getBoundingClientRect().width >= this.$dropdown[0].getBoundingClientRect().width) {
this.$dropdown.css({
width : '100%'
});
}
};
}());
});

0 comments on commit 20beb5f

Please sign in to comment.