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

On 04/22/2013 04:50 PM, Elliott Sprehn wrote:
> Recently the spec for flexbox was changed so that the min-width of flex items was no longer min-content (mutatis mutandis for
> height), but this produces some bad behavior when using replaced things like <button> or <img> as flex items. Previously they
> had an implicit min-width: min-content which would prevent them from becoming smaller, but now they'll end up being crushed.
> [...]
> Before this change was made to the spec the min-width was min-content which worked fine for this but had other bad behavior
> like making overflow: scroll on a flex item behave unexpectedly since the item would expand out to the min-content size.
> [...]
> Both of these have proven to be surprising behavior, instead I think we should combine the behavior so the min-width is
> min-content unless your overflow property computes to a value other than visible in which case it should be 0.
>
> This special cased behavior gives a sensible result for <img> and overflow: scroll as flex items.

Hi Elliot,
Based on implementation experience from IE, the CSSWG has agreed
to take your proposal. The 'auto' value has been restored as the
initial value of min-width/height, and its definition modified
to account for 'overflow' (as you recommended) and specified
'width'/'height' (which was another potential surprise point).

The new definition for 'auto' is:
   # On a flex item whose overflow is not visible, this keyword
   # specifies as the minimum size the smaller of:
   #
   #  * the min-content size, or
   #  * the computed width/height, if that value is definite.
   #
   # Otherwise, this keyword computes to 0 (unless otherwise
   # defined by a future specification).

Let us know if you have any further comments on this.

~fantasai

Received on Wednesday, 19 March 2014 19:23:50 UTC