Hidden Select2 is not rendering well


#1

Hello,

This is a very old bug and I tried to do so much thing to work accross but it still not resolved with last versions.
When you initialize a select2 input that is hidden and then show it, it does not render correctly and it have not the same appearance if this is initialized as shown element.
The most common case if for me when I am using a modal dialog, mostly with bootstrap.

Here is an example jsfiddle
https://jsfiddle.net/Loenix34/e2dba1tn/24/

Is there an existing solution ?
Or have I to use tricky solution ?

Any help will be appreciated.


#2

Change your select2 initialization call to this, and it will work:

$element.select2({width: "100%"});

I tried it in your fiddle, and after that change both buttons produce the same results.