bug 0.9.4 CSS broken: button with caret moved to next line
Here's how it looks:

Additionally, it now looks weird, when container width is not specified:

0.9.2 looks:


Angular 1.3.6 / Bootstrap 3.3.1, ui-select bootstrap theme.
I'm also seeing this problem with the bootstrap theme since updating to 0.9.4 to use the allow-clear functionality on single select controls.
@amcdnl I think this was caused by https://github.com/angular-ui/ui-select/commit/597bb218f44d23c2cf8ba31646b2766039d3b1de#diff-8156b6c885865950b8b7f9e2c857096eR1146 and/or https://github.com/angular-ui/ui-select/commit/597bb218f44d23c2cf8ba31646b2766039d3b1de#diff-93955e143fd7bf0d3c1dd8bcf781c3f3R43 - can you take a look?
I don't think that using bootstrap's grid inside button is a good idea.
+1 I know that I'm not helping, but... Somebody found any workaround already?
What would be helpful is if someone could try to debug the issue. If someone can post working / fixed code, then I can get a hotfix merged.
I have found that if I set the width to at least 300px then it won't wrap. I don't understand why there are col-* classes inside a btn-group. That makes no sense to me. This is breaking a lot of things in our app currently. The only thing I can think of is to remove these classes because they are unnecessary. The only other fix is to keep your selects above 300px width.
https://github.com/angular-ui/ui-select/blob/master/src/bootstrap/match.tpl.html#L2 https://github.com/angular-ui/ui-select/blob/master/src/bootstrap/match.tpl.html#L6 https://github.com/angular-ui/ui-select/blob/master/src/bootstrap/match.tpl.html#L9
After reading through the code and playing with this for a bit I understand why we are using the col classes. It allows us to fill the width. I just don't understand why it stops working when a dropdown is smaller than 300px
The reason is because bootstrap columns themselves have a minimum width, hence they're not appropriate in this context. They respond to responsive breakpoints and become full-width at those breakpoints.
I found that if I changed the col to be a col-md-9 instead of a col-md-11 then it kept it from wrapping. Also the small screen size keeps it from wrapping
Its just a hacky way to solve this. And I agree that columns aren't appropriate in this context. I'm trying to find a way to get the buttons to fill the parent container without using bootstrap columns
Thanks for the feedback @SerenadeX, for now I'd like to wait for a response from @DanielClausen
Hey, this is my fix for that issue, col- classes are not a good option here IMHO, instead I use flexbox, which is extremely easy to setup... but IE10+ only:
// Overwrite ui-select template, to use flexbox model instead of buggy bootstrap grid model
angular.module("ui.select").run([
"$templateCache",
function($templateCache) {
$templateCache.put("bootstrap/match.tpl.html", "<div style=\"display: flex\" class=\"btn-group ui-select-match btn-block\" ng-hide=\"$select.open\" ng-disabled=\"$select.disabled\" ng-class=\"{\'btn-default-focus\':$select.focus}\"><button style=\"flex-grow: 1;\" type=\"button\" class=\"btn btn-default\" tabindex=\"-1\" ng-click=\"$select.activate()\"><span ng-show=\"$select.isEmpty()\" class=\"text-muted\">{{$select.placeholder}}</span> <span ng-hide=\"$select.isEmpty()\" ng-transclude=\"\"></span></button> <button class=\"btn btn-default\" ng-if=\"$select.allowClear && !$select.isEmpty()\" ng-click=\"$select.select(undefined)\"><span class=\"glyphicon glyphicon-remove ui-select-toggle\"></span></button> <button class=\"btn btn-default\" ng-click=\"$select.activate()\"><span class=\"caret ui-select-toggle\" ng-click=\"$select.toggle($event)\"></span></button></div>");
}]);
+1
Please fix this issue. Meanwhile I roled back the update to the updated version.
I fixed this in a different way from what was mentioned above; I used calc. My solution's very specific for my use case, but it basically boils down to this:
.ui-select-match > button.col-sm-10 {
width: calc(100% - 34px);
}
.ui-select-match > button.col-sm-8 {
width: calc(100% - 73px);
}
This means that the caret button will need to be a fixed width (this is easily doable in my experience), and you will need to apply a class to this button if clear selection is enabled and something is selected. That class will need to override the calc width, but that's also easily doable.
While I'm sure that using something like flex-box might be more desirable for other reasons, I've found the calc() is pretty simple and very well supported. It's how I'd suggest solving this issue, personally.
Faced with the same issue.
Fix released in v0.9.6