Skip to content

Flexbox: don't wrap auto-height column containers against ancestor-derived available space - #1176

Merged
nicoburns merged 1 commit into
mainfrom
devin/1788186457-wrap-column-available-space
Aug 31, 2026
Merged

Flexbox: don't wrap auto-height column containers against ancestor-derived available space#1176
nicoburns merged 1 commit into
mainfrom
devin/1788186457-wrap-column-available-space

Conversation

@nicoburns

Copy link
Copy Markdown
Member

Objective

Fixes #1175.

An auto-height flex-wrap: wrap column container could wrap its lines against AvailableSpace::Definite main-axis space handed down by an ancestor (typically during a ComputeSize/ContentSize measurement round), even though its own main size is content-based. This showed up as one-frame layout flicker while animating a child's height: for the frames where the content total exceeded the ancestor-derived available height by a couple of ulps, the container split into two columns. Chrome keeps a single line for the equivalent DOM.

The wrap constraint in collect_flex_lines (and collect_balanced_flex_lines) previously fell back to available_space.main(dir) whenever the container had no max main size:

let main_axis_available_space = match constants.max_size.main(dir) {
    Some(max_size) => AvailableSpace::Definite(/* min(available, max) when size indefinite */),
    None => available_space.main(dir),   // <-- ancestor-derived Definite leaked in here
};

Now, for a column container with no definite main size and no max main size, definite available space is replaced with MaxContent (no wrapping), since an automatic block-axis size never resolves against available space:

    None if !dir.is_row() && !has_definite_main_size && available.is_definite() => AvailableSpace::MaxContent,
    None => available_space.main(dir),

Rows are unchanged: an automatic inline-axis size does resolve against available space (fill-available), so row containers still wrap against definite available width. Min/max-content constraints and containers with a definite main size or a max main size are also unchanged.

Context

Feedback wanted

The fix keys on !dir.is_row() as a proxy for "main axis is the block axis" (taffy has no writing modes). If you'd prefer the same treatment for rows under some condition (e.g. only during ContentSize sizing rounds), happy to adjust — but as-is, rows keep the fill-available wrapping behavior that matches browsers for block-level row containers.

Link to Devin session: https://dioxus.staging.devinenterprise.com/sessions/b637316906704d10ba77a4da9f248d4e
Open in Devin Desktop: https://dioxus.staging.devinenterprise.com/desktop/session/b637316906704d10ba77a4da9f248d4e?variant=devin-insiders
Requested by: @nicoburns

@staging-devin-ai-integration

Copy link
Copy Markdown

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@nicoburns
nicoburns merged commit ac2b869 into main Aug 31, 2026
28 checks passed
@nicoburns
nicoburns deleted the devin/1788186457-wrap-column-available-space branch August 31, 2026 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Auto-sized wrapped flex container wraps lines against ancestor-derived definite available space during content-size measurement

1 participant