Skip to content

[css-sizing][css-overflow][css-flexbox] Ability to control the sizing of the overflown content area #8725

@kizu

Description

@kizu

I did recently stumbled upon some weirdness regarding how flex and overflow interact.

I could not find an issue that would talk about it, and couldn't find the exact place in the specs that describe this interaction, so would be helpful for any directions!

Disclaimer: this might be also the case for display: grid, I did not thoroughly tested anything other than display: flex for now.

References:

The problem:

  • When we have a container that has both display: flex and a non-visible overflow (my exact case was with overflow: auto), we do not have any control on how the inner content box of the overflowing container is sized, resulting in content always shrinking up to the items' respective min intrinsic sizes:

    Screen.Recording.2023-04-14.at.21.19.44.mov
  • What I want to have, achivable, for example, if we would instead move the flex container inside the container with the overflow — we get control over how it would behave via min-width or height: the container is sized to fit all the items:

    Screen.Recording.2023-04-14.at.21.20.18.mov

My proposal:

  • Add a CSS property (or multiple?) that would control how the content area of the overflowing container should be sized.

Current workarounds:

  1. The already mentioned separation of the overflow and flex — allows achieving both cases: when we want things to shrink, or not.
  2. Using .flex > * { flex-shrink: 0; } — kinda works, but only for the start value of the justify-content property, otherwise things behave not in a desired way.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions