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: Wed, 13 Sep 2017 23:12:02 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-329322781-1505344312-sysbot+gh@w3.org>
My second nit: the math/units don't work out when we're using scaled flex shrink factor. Example below to illustrate this.

Scenario: Just one flex item (for simplicity) with max-content size of `200px`, and `flex: 1 1 400px`.

Ideal outcome (I think?): flex container should end up exactly 200px wide (forcing item to shrink to its max-content size).

Current draft's algo walkthrough:
 1. compute mcff: first, do 200px-400px = -200px, which is negative so we divide by scaled flex shrink factor, so we get -200px / 400px = **-0.5** (unitless value)
 2. Item goes on its own line.
 3. Largest mcff is the only one, which is -0.5.  It's negative, so we're using flex-shrink. Sum of flex-shrink factors isn't less than 1, so there's no factor-rescaling needed.
 4. "Add each item's flex base size to the product of its... rescaled flex shrink factor ... and the chosen mcff".  So, we do `400px + (1 * -0.5)` (with the latter term having no units, notably)... So we get `399.5px` (if I disregard the units)
 5. The flex container ends up being that size, 399.5px, which makes no sense.

I think some piece of this algorithm wants to use the flex shrink factor instead of the scaled flex shrink factor, or vice versa, or needs to un-scale a computation somehow...

GitHub Notification of comment by dholbert
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1735#issuecomment-329322781 using your GitHub account
Received on Wednesday, 13 September 2017 23:11:55 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:41:18 UTC