Closed kvikram1988 closed 9 years ago
+1
It looks like part of the issue is that .select2-hidden-accessible
does not use !important
when it should, so Bootstrap's styles are making it visible. But only sometimes...
Yeah, either we can use !important or increase the specifitivity of the class.
This somehow happened with Select2 moving from 4.0.0-rc.2 to 4.0.0. Duplicate of #8.
It looks like part of the issue is that
.select2-hidden-accessible
does not use!important
when it should,
@kevin-brown Shouldn't !important
be part of the default CSS for .select2-hidden-accessible
then?
Select2 v3.5.2 added .select2-offscreen
to the original <select>
element, which has the !important
that v4.0.0's .select2-hidden-accessible
is currently missing.
Select2 v4.0.0-rc.2 added a style="display: none;"
instead of .select2-hidden-accessible
to the original element – that's why things were working with Select2 v4.0.0-rc.2/before the final release of v4.0.0.
so Bootstrap's styles are making it visible. But only sometimes...
"Only sometimes": When Select2 is inside a .input-group
, Bootstraps CSS will be more specific than the styles for .select2-hidden-accessible
:
.input-group .form-control {
position: relative;
z-index: 2;
float: left;
width: 100%;
margin-bottom: 0;
}
A temporary fix as mentioned above is to either add !important
to .select2-hidden-accessible
s position: absolute
…
.select2-hidden-accessible {
position: absolute !important;
}
… or to explicitly target .form-control.select2-hidden-accessible
…
.form-control.select2-hidden-accessible {
position: absolute;
}
… or to simply remove .form-control
from the original <select>
element.
@kevin-brown Shouldn't !important be part of the default CSS for .select2-hidden-accessible then?
Yes. Pull requests to select2/select2 are always encouraged.
Specifically...
height
width
position
... all need !important
added to them.
Yes. Pull requests to select2/select2 are always encouraged.
OK will do, give me a few hours.
Do you know anything that speaks against adding !important
to all rules in .select2-hidden-accessible
as v3.5.2 did for .select2-offscreen
?
http://fk.github.io/select2-bootstrap-theme/ completely broken. When is it expected to be fixed, any idea??