Open vercotux opened 8 years ago
Same issue as above here.
I realized this issue belongs in yii2-widget-select2. @kartik-v Possible to move?
Some additional findings:
The problem lies exactly in Select2's resizeSearch()
method.
As you can see, when the placeholder is set, the script overrides the CSS style with the width it gets using jQuery's innerWidth()
from the .select2-selection__rendered
container class. This seems to fail in some cases (eg. when Select2 is inside a hidden modal window).
One workaround is to override the CSS with a fixed width:
.select2-selection__rendered {
width: 500px !important;
}
Even with the '__rendered' CSS above the Input was still defaulting to 100px, so I made it more precise to target the Input directly,
.select2-search--inline input {
width: 700px !important;
}
When setting
multiple
to true and specifying aplaceholder
containing text that is longer than 100px, it will be truncated by a CSS rule set by Select2 javascript.This seems to be an upstream issue with Select2, but they are not doing anything to fix it. Their bug report is closed and the workarounds do not work with this widget. We need a solution that works with this widget.