Closed Bug 1892561 Opened 5 months ago Closed 5 months ago

Wrong width when using "flex-wrap: wrap", "width: max-content" and "column-gap" at the same time

Categories

(Core :: Layout: Flexbox, defect)

Firefox 126
defect

Tracking

()

RESOLVED DUPLICATE of bug 995020

People

(Reporter: jiazhen.ruan, Unassigned)

Details

Attachments

(2 files)

Attached image Snipaste

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:125.0) Gecko/20100101 Firefox/125.0

Steps to reproduce:

The width of the flex-wrap element should be 170px, not 50px. By the way, this problem also exists in chrome, but the width is 150px.

Example link: https://codepen.io/vcxldk/pen/NWmLZQO

code:

<html>
  <body>
     <div class="container">
  <div class="flex-wrap">
    <div class="box">1 50*50</div>
    <div class="box">2 50*50</div>
    <div class="box">3 50*50</div>
    <div class="box">4 50*50</div>
    <div class="box">5 50*50</div>
    <div class="box">6 50*50</div>
  </div>
</div>
<style>
.container {
  width: 100px;
  height: 100px;
  position: relative;
}

.flex-wrap {
  position: absolute;

  width: max-content;
  height: 100%;

  box-sizing: content-box;
  background-color: gray;

  display: flex;
  flex-wrap: wrap;
  flex-direction: column;
  column-gap: 10px;
}

.box {
  box-sizing: border-box;
  width: 50px;
  height: 50px;
  border: solid 1px black;
  color: white;
}
</style>
</body>
<html>

Actual results:

When using the following CSS attribute at the same time, the width of the elastic container cannot be stretched properly by the quilt element and the column gap:

width: max-content;
display: flex;
flex-direction: column;
column-gap: 10px;
flex-wrap: wrap;

Expected results:

The width of the flex-wrap element should be 170px。

The Bugbug bot thinks this bug should belong to the 'Core::Layout: Flexbox' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Layout: Flexbox
Product: Firefox → Core

I think this is essentially a dupe of bug 995020. We don't take the height constraint into consideration when determining the max-content width, for now at least, so that's why we optimistically size the flex container as if it didn't need to wrap.

Status: UNCONFIRMED → RESOLVED
Closed: 5 months ago
Duplicate of bug: 995020
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: