W3C home > Mailing lists > Public > www-style@w3.org > June 2014

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

From: Daniel Holbert <dholbert@mozilla.com>
Date: Mon, 30 Jun 2014 10:38:44 -0700
Message-ID: <53B1A0A4.6090402@mozilla.com>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
CC: www-style <www-style@w3.org>
On 06/29/2014 09:44 AM, Tab Atkins Jr. wrote:
> On Sat, Jun 28, 2014 at 4:39 PM, Daniel Holbert <dholbert@mozilla.com> wrote:
>> On 03/19/2014 12:23 PM, fantasai wrote:
>>> 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".
> 
> I don't want to reverse this behavior, but if it's too problematic for
> min-width, perhaps we should just move this functionality to a new,
> flexbox-specific property instead.
> 
> ~TJ
> 

I've got one idea for an alternative...

So, I'm assuming the old min-width:auto behavior caused author confusion
primarily **when flex-basis was auto**. (That would make us defer to
"width", but we'd confusingly stop deferring to it when it fell below
the min-content size, with the old min-width:auto behavior.)

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**.

This option would allow the following flex item to take on its specified
1px (smaller than its min-content width), making for happy authors:
  <div style="flex: none; width: 1px;">def</div>
...since here, the flex-basis is auto, which means we'd consider the
used value of flex-basis (1px here, copied from 'width') as a source for
min-width.

Meanwhile, this option would mean we could go back to disregarding
"width" when flex-basis is explicitly specified, e.g. here:
  <div style="flex: 0 5px; width: 1px;">WiiiiideText</div>
With the current ED spec language, we have to consider "width" when
determining the used min-width of this flex item.  I find that
confusing, since 'width' is otherwise disregarded here for sizing
purposes.  With my suggested change, we'd go back to completely ignoring
'width' here, and we'd snap the flex item to its min-content size.
Authors that really want to manipulate the minimum size of the flex item
here could still do so by setting "min-width" directly.  (And they
probably won't be expecting any particular results here from setting
"width", since they're setting "flex-basis" which should override it for
sizing purposes.)

>From an implementation perspective, this change would be convenient
because it means we can continue to ignore "width" when sizing a flex
item -- we only have to consider flex-basis [which may or may not be a
clone of 'width].

~Daniel
Received on Monday, 30 June 2014 17:39:12 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:22 UTC