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

On 03/19/2014 12:23 PM, fantasai wrote:
> 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.

I'm concerned about the second change described here -- the second
bullet-point, which makes "min-width:auto" depend on the computed value
of "width".

(For simplicity, I'll stick with width/min-width/horizontal-flexbox for
this email, but this all applies to height/min-height/vertical-flexbox
as well.)

This change concerns me for two reasons:

 (a) Normally, 'min-width' works by influencing the used value of
'width'.[1]  This is a one-way relationship.  However, the change quoted
above creates a cyclic relationship[2] between the properties, by
adding a new channel of influence in the reverse direction. This adds
complexity and makes the relationship between these properties more
confusing.

 (b) Until now, a flex item's 'width' property has had basically no
influence on flex layout (in a horizontal container), since 'flex-basis'
completely takes its place for sizing purposes.  (The one exception is
when we have "flex-basis:auto", which clones 'width' -- but even then,
we're really just dealing with the clone in flex-basis.)  But this
change adds a new, more complex channel where 'width' subtly impacts
flex layout. (by being one of the sources of "min-width:auto"'s used value)

I assume the reason this change was added was to address situations like:
  <div style="flex: none; width: 1px;">def</div>
The old min-width:auto behavior would've made this flex item as wide as
the text, instead of the specified 1px width, which was understandably
confusing for authors.

However, I think the change (making computed 'width' influence used
'min-width') is fairly broad as a means to address that narrow use-case,
and perhaps too "magical".

~Daniel

[1] http://dev.w3.org/csswg/css2/visudet.html#min-max-widths
[2] The circular relationship is as follows: the computed value of
'width' will now influence the used value of 'min-width', which then
feeds back into the used value of 'width'. Fortunately, it stops cycling
at that point (and technically each step is about a different quantity,
due to the 'used' vs. 'computed' distinction), but the fact that there's
any back-and-forth at all between these properties makes things more
confusing/complex.

Received on Saturday, 28 June 2014 23:39:46 UTC