Re: [css3-flexbox] Change the behavior of omitted flex-shrink in the flex shorthand

On 05/17/2012 09:00 PM, Tab Atkins Jr. wrote:
> Issue link: http://wiki.csswg.org/topics/css3-flexbox-default-shrink-when-grow-is-0
>
> We discussed this at the F2F, but didn't come to a conclusion, as it
> was right at the end of the period.
>
> To address other issues, we changed the default for 'flex-shrink' from
> 0 to 1 during the F2F.  However, this means that the behavior of
> “flex: 0<length>;” changes - it can now shrink, where before it
> couldn't.
>
> We propose to make an omitted flex-shrink default to 0 if the
> flex-grow is given as 0 in the flex shorthand.  I think dbaron was
> weakly against this during the F2F.  David, how do you feel?

I'm okay either way, but I'd like to note there's actually a good use case for
the behavior given by 'flex: 0 <basis>' if it continues to default to 1: sidebars.

Suppose I want the sidebar to be auto-sized, or percentage-sized, and I want the
rest of the document to take up the remaining space. But I want the rest of the
document to have a min-width of 15em, otherwise it's unreadable. At large sizes,
I'd want the sidebar to be max-content/percentage-size. But once the main content
hits its minimum, I'd like the sidebar to be allowed to shrink down to its
min-content size (or some explicit minimum size). The text in the sidebar will
now start to break across lines, which I don't want when I have plenty of space--
but more important than that is avoiding overflow and keeping the main area readable,
so I want to allow breaks at narrow sizes and let the sidebar shrink below it's flex
basis.

Just something to think about. :)

~fantasai

Received on Thursday, 31 May 2012 05:03:29 UTC