multiple md-select overflows incorrectly the input-container
Hello
there is an issue if the selected values of md-selectexpand md-input-container. Here the codepen and a screenshot:
http://codepen.io/anon/pen/LGGNoo
I suggest the md-selectshould grow with the selected options and expand the md-input-containerheight.
@rschmukler Not sure if this is the best solution, but here is a quick fix/workaround for this issue:
.md-select-value *:first-child {
width: calc(100% - 24px);
}
I don't see anything in the spec about how to handle this situation, but it looks like we're already assuming that we will cut it off and use an ellipsis, it just wasn't working correctly.
:+1:
:+1:
+1
I've noticed this bug as well. It seems to be working fine on version 0.10.x but not on versions 0.11.x and on Version 10: http://plnkr.co/edit/T1UzWlWY8aaMWrM9xPWb?p=preview There's also a version 0.11 there that was added locally so you can switch to see the bug on version 0.11. Here's a live example with 1.0.2: http://plnkr.co/edit/hTBqUnFQQekNEy5YUVc5?p=preview
+1
I found this workaround:
http://codepen.io/anon/pen/MKzYNY
Just fix styles:
.md-select-value *:first-child { flex: 1 1 auto; }
@anatolyz did you try your workaround inside of Firefox? For me the workaround only works with Chrome.
@dohomi, I checked in versions 41.0.1, 43.0.1, 44.0.1 (updated twice), it works.
It would be great if the overflow was hidden. It would be even better if you could change the display to show something like "5 of 25 selected"
This issue is closed as part of our deprecation effort. For details, see our post Spring Cleaning 2016.
how is this closed?
@bobwah https://github.com/angular/material/issues/6312#issuecomment-215541062 can't you read ?
I can read it was deprecated when could have been fixed with simple css within material rather than having to apply our own...
If you check out the newest version of material you will see that the handling changed: now every option is wrapped into a new line
With Angular Material 1.1.1 this behaviour changed again. Instead of putting the selected option on separate lines they are now aligned next to each other again. This causing the select to get a growing width after selecting more options. Is there a way to fix this? See screenshot

Would be nice if you can set a fixed width and the line of selected options would be truncated.
@volmerf The md-select is designed like most HTML elements to grow and shrink based on the size of it's content. If yours is too large, you have a few options:
- Set a
max-widthin the CSS as I've done here: http://codepen.io/topherfangio/pen/amLbEo - Just set the
widthin the CSS, or - Use
flexto make it take up a certain size in it's container.
All three of these will ensure that the text is truncated when there is too much to fit.
Are you facing a situation where one of the three options above won't work?
@topherfangio : Nice suggestion. You saved my time.
Are you facing a situation where one of the three options above won't work?
Yes, this seems to be broken. Sure, if I put flex="30" on my <md-input> it will keep the contained <md-select> from growing more than 30% of the width of my $mdDialog, even though I keep selecting items in the list:
<div layout="row" layout-xs="column" layout-padding>
<md-input-container flex="30">
<label>Foo</label>
<md-select ng-model="dialog.foo" ng-model-options="{trackBy: '$value.id'}" multiple>
But here's the huge problem: if I keep selecting items in the list, soon the $mdDialog will start increasing its width as if the <md-select> were expanding horizontally!! It's as if I've prevented the visible part from expanding, but something invisible is still expanding horiontally. Specifically the <div layout="row" is still expanding, taking up the full space, and making the dialog grow wider, even though the <md-select> is still at its 30%-of-the-width size.
This still happens if I take out the <md-input-container> and <label>, and put the flex="30" directory on the <md-select> --- the <div> still increases its width as if the <md-select> were invisibly getting wider. But it's not --- I can even put text to the right of the <md-select> and the text never moves, but the <div> gets wider!
@garretwilson Can you provide a Codepen that I can play with and maybe fix?