W3C home > Mailing lists > Public > public-css-archive@w3.org > September 2017

Re: [csswg-drafts] [css-flexbox][css-grid] Intrinsic sizing with ∑flex < 1 is broken

From: Daniel Holbert via GitHub <sysbot+gh@w3.org>
Date: Fri, 22 Sep 2017 00:34:37 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-331318337-1506040465-sysbot+gh@w3.org>
Possible problem (not sure): the current algorithm is discontinuous when a flex factor reaches 0.

Consider a simple scenario with just a single flex item, with `flex-basis: 100px` and max-content size of `200px` (like the first item in Tab's example above). Right now, this intrinsic sizing algorithm will give the a flex-container an intrinsic size of...
 * `100px`, if the item's flex-grow is **exactly zero**.
 * `200px`, if the item's flex-grow is **anything nonzero**.

This distinction makes *some* sense to me -- if the flex item isn't flexible, then clearly it's not going to be able to grow at all beyond its `100px` flex-basis (if we assume there's no `min-width` interfering with things).  So: it's reasonable to say that the flex container doesn't need to be any larger than `100px` in this case -- so that makes some sense as an intrinsic size.

And on the other hand, for all nonzero flexibilities, it seem reasonable to always size the container to the (sole) item's full max-content size (as the "target size") and then let the flex layout algorithm size the item to some intermediate growth point towards that target, depending on whether the flexibility is fractional or not.  (This is basically what would happen with the algorithm as-written now.)

Still: despite this apparent reasonableness, it's unfortunate that this creates a discontinuity.  Maybe we should try to set up the algorithm so that its behavior for inflexible items is equal to the *limit* of its behavior for flexible items with fractional flexibilities?  (I think that was part of the motivation here, right?)  Or would that cause other problems?

-- 
GitHub Notification of comment by dholbert
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1735#issuecomment-331318337 using your GitHub account
Received on Friday, 22 September 2017 00:34:30 UTC

This archive was generated by hypermail 2.4.0 : Thursday, 24 March 2022 20:26:43 UTC