-
Notifications
You must be signed in to change notification settings - Fork 301
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Auto width for longer options #129
Comments
The problem occurs when content gets really long. That said, this might be a nice option to add. Perhaps { fitOptionsMaxWidth: int-max-width }? |
@sfentress The real reason dynamic widths are not yet supported with SelectBoxIt, is because I was looking for a CSS only solution for this and could not find one that worked for all SelectBoxIt supported themes. A possible CSS only solution that works with the default theme is to set the I completely agree with you that using auto widths should be supported. On that note, your jsfiddle example is not a true auto width experience, since when you click an option that is not as long the drop down stays the same width. If you want to upgrade your jsfiddle demo and submit a pull request, I'm sure a lot of users would be appreciative. If you don't have time/don't want to submit a PR, I or @ronlussier can come up with a JavaScript auto width solution for the next release. Let me know! |
That's true (although again, it's what traditionally happens with a select, so it may be what folks expect). I think a fitOptionsMaxWidth would be a perfect solution, and even better if not adding one allowed the box to keep expanding. |
@gfranko I think that it is "true" autowidth in the manner that folks familiar with normal select boxes would expect it. A select box that kept changing width, causing re-flow of the document, would be annoying, I'd think. I'm not sure at the moment I'd be able to make a nice pull-request with tests and what-not. At the moment I'll have to stick to my hacky after-the-fact solution. However, I can certainly try to look at it later if it seems like it would be a useful option. Thanks! |
@sfentress Good point about most people expecting a static width. It might be best to create two options (one for dynamic widths and one for static widths). We will take a look at this for the next release and try to get something out by the end of this week. I'll update this ticket and let you know when it is ready to be used! |
@gfranko That sounds quite excellent! |
… to true, and upgraded the default SelectBoxIt disabled theme
I just released SelectBoxIt v3.3.0, which adds a new |
When options are longer than can fit in the 220px box, they get cut off.
I know that width has been brought up in the issue list a number of times, but the answer generally seems to be "set your width explicitly in your css." This doesn't work if we have dynamic content and don't know ahead of time how wide our boxes need to be.
Regular select boxes handle dynamic widths just fine, so it's natural to assume that this would as well.
I have a simple jsFiddle which auto-sets the width and max-widths of the select box to fit the widths required by the contents: http://jsfiddle.net/SamFent/TYpRq/. The text inside that last select can be made arbitrarily long, and the select box expands to fit.
Is there any reason why this pattern can't be the default, or at least an option?
The text was updated successfully, but these errors were encountered: