Re: [css-flexbox] min-width/height: min-content defaults for replaced items and overflow containers

On 06/30/2014 03:29 PM, Tab Atkins Jr. wrote:
>> Based on that assumption, I think we could perhaps more narrowly scope
>> the new min-width:auto behavior to address this use case case. In
>> particular: instead of making min-width/min-height:auto pull from the
>> computed width/height, we could instead make it pull from the computed
>> "flex-basis", **when computed flex-basis is auto**.
> 
> Why not just make it always pull from 'flex-basis'?  I think having it
> pull from 'width' might have been an accident.  That would have the
> same benefits you cite in the rest of your email.

That would break the "flex: [positive-number]" use-case, I think.

The scenario there would be e.g.:

  <body>
  <div style="display:flex; width: 100%">
    <div style="flex: 1">A B C</div>
    <div style="flex: 1">DDDDD</div>
  </div>
  </body>

Let's say that both runs of text have a preferred width of 100px. For
the second flex item, that's also its min-content size, since there are
no line-breaking opportunities in "DDDDD".

Now, if the container ends up having a width of e.g. 180px, we might
naively assign widths of 90px/90px to the items, but really the best
outcome is probably 80px/100px, so that there's no "D" text overflowing.

The "min-width:auto" behavior has traditionally given the desired
80px/100px result.  But if we make min-width:auto always take
"flex-basis" into account, we'd end up with 90px/90px (and overflowing
"D" text) in this scenario.

So I don't think we can unconditionally make the min-width take
'flex-basis' into account. I think it might only make sense to depend on
it when we have "flex-basis:auto" and "width" set to something definite,
because then the authors will have stronger expectations about their
specified "width" being respected.

~Daniel

Received on Monday, 30 June 2014 23:01:00 UTC