-
Notifications
You must be signed in to change notification settings - Fork 658
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[css-flexbox] Conflicting definitions of used cross size of a flex container #5190
Comments
…matting context, rather than assuming block layout. #5190.
Yeah, looks like this rule pre-dates some of the more structured Sizing work, and isn't really correctly phrased: it only works for block and inline layout. Rewrote it to rely on the sizing rules of the formatting context in which the flex container participates (whatever those happen to be), and just provide a content-based size as input for when that's needed. (Grid already uses the correct text similar to this.) Let us know if this addresses your concerns. |
dbc8f6d solves the conflict, but maybe not in the intended way. For example, for a block-level column flex container, the cross size is the inline size and https://drafts.csswg.org/css2/visudet.html#blockwidth never uses a content-based size. Instead I think the intended behavior is that an |
Sketch of what this could look like, to avoid having everything "patch" block layout like css2-tables do and also properly fix #4905:
In CSS2 the general model is roughly that width are in input decided by parents, and height is an output based on children. In the model above two-dimensional available space is an input, two-dimensional used size is an output. This is also more compatible with orthogonal flows (writing mode change). The Flex Layout Algorithm is already written this way, I assume to avoid special-casing row v.s. column flex containers in many places. Adopting this everywhere would be good, but this is a more substantive change than we may want to do normatively within CSS2… |
@SimonSapin Wrt #5190 (comment)
Agreed, and to a certain extent we're trying to do this by having each layout mode define its min-content and max-content sizes and size contributions, and having the specs for each formatting context reference those sizes of the items they are laying out. p.s. sorry for the late response; we haven't triaged flexbox issues for far too long. :( |
I’ll trust your judgment here. I haven’t been looking at Flexbox since not long after filing this so I don’t really have a mental model anymore of how these spec interactions work (and how I thought they ought to work) |
https://drafts.csswg.org/css-flexbox/#algo-cross-container specifies the used cross size of a flex container, based on that of flex lines and therefore of flex items. However the container itself participates in an "outer" formatting context that typically also specifies a used size, with a different algorithm.
For example, for a block-level horizontal column flex container, the cross size is the width and https://drafts.csswg.org/css2/visudet.html#blockwidth applies.
For comparison, tables in CSS 2 have normative text specifically about resolving this conflict: https://drafts.csswg.org/css2/tables.html#width-layout
I didn’t find anything similar in css-flexbox. Should it be added?
More generally, for elements that establish an independent formatting context it would be nice to have a common "protocol" for how the inner and outer layout modes interact with each other, in order to support arbitrary combination and not need separate definitions for each pair. (What happens for a grid item table? A table cell flex container?)
The text was updated successfully, but these errors were encountered: