W3C home > Mailing lists > Public > public-css-archive@w3.org > July 2021

[csswg-drafts] [css-flexbox-1] When can available space for flex items be infinite? (#6476)

From: Andy Jakubowski via GitHub <sysbot+gh@w3.org>
Date: Tue, 27 Jul 2021 10:18:25 +0000
To: public-css-archive@w3.org
Message-ID: <issues.opened-953729503-1627381104-sysbot+gh@w3.org>
andyjakubowski has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-flexbox-1] When can available space for flex items be infinite? ==
I’m implementing [Step 2: determine the available main and cross space for the flex items](https://drafts.csswg.org/css-flexbox-1/#algo-available), and I’m trying to better understand what constitutes definite and indefinite sizes, and by extension definite and infinite available space.

[CSS Box Sizing Level 3](https://drafts.csswg.org/css-sizing-3) defines [definite size](https://drafts.csswg.org/css-sizing-3/#definite) as:
> A size that can be determined without performing layout; that is, a <length>, a measure of text (without consideration of line-wrapping), a size of the initial containing block, or a <percentage> or other formula (such the “stretch-fit” sizing of non-replaced blocks [CSS2]) that is resolved solely against definite sizes.
> Additionally, the size of the containing block of an absolutely positioned element is always definite with respect to that element.

It wasn’t clear to me if intrinsic sizes counted as definite, and after some digging found [[css-sizing] definite sizes and shrink-wrapping](https://lists.w3.org/Archives/Public/www-style/2016May/0244.html) and the [WG resolution](https://www.w3.org/2016/05/09-css-irc#T21-51-29) saying that:
> treat intrinsic sizes as definite when they don't rely on layout, by default

Approaching this from another angle, I tried to think if situations where the available space could possibly be infinite. These are the cases I was able to identify:
- flex container `block-size` computes to `auto`, and the flex container participates in flow layout
- flex container `block-size` computes to a `<percentage>`, and the containing block’s `block-size` depends on content; this creates a cyclic dependency, so `<percentage>` behaves as `auto`

Interestingly, I wasn’t able to think of one situation where the available space in the inline dimension of the flex container would ever be infinite. Even in orthogonal flows the inline size of the flex container seems to be resolved against a fallback size defined in [Available Space in Orthogonal Flows](https://drafts.csswg.org/css-writing-modes-4/#orthogonal-auto). I was unable to reproduce the case where the flex container would lay its box out at its `max-content` size when given “infinite available inline space” as described in  [Auto-sizing Other Orthogonal Flow Roots](https://drafts.csswg.org/css-writing-modes-4/#orthogonal-layout).

So I have two questions:
- is there a finite list of cases where available space for flex items can be infinite? Is my list correct?
- alternatively, how should one interpret phrases like “performing layout”, or “real layout” when trying to identify definite sizes which shouldn’t rely on layout?

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6476 using your GitHub account

Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Tuesday, 27 July 2021 10:18:27 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:42:39 UTC