Closed Bug 1911472 Opened 9 months ago Closed 8 months ago

Container Takes Original Width Of Image

Categories

(Core :: Layout: Flexbox, defect)

Firefox 128
defect

Tracking

()

RESOLVED DUPLICATE of bug 1742042

People

(Reporter: klausgy, Unassigned)

References

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0

Steps to reproduce:

I ran the following fiddle: https://jsfiddle.net/avbqdw03/13/

Alternatively, this code:

<div>
  <span>
    <img src="https://placehold.co/600x400">
  </span>
</div>
div {
  position: fixed;
  height: 50px;
  display: flex;
  background: red;
}
img {
  height: 100%;
}

Actual results:

The div container takes on the 600px original width of the image, although the image is scaled down to 50px height.

Expected results:

Other browsers render the div in the same size as the image, i.e. you see no red background. I don't know what the spec says, but people on Reddit suggested I should file a bug nontheless.

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

Component: Untriaged → Layout
Product: Firefox → Core

This seems to be specific to the use of display: flex on the div, so moving to the Flexbox component.

Group: core-security-release
Severity: -- → S3
Component: Layout → Layout: Flexbox

Ugh, I must've inadvertently touched that security flag.... clearing it.

Group: core-security-release

Thanks for reporting. Made a standalone testcase based on the jsfiddle in comment 0.

It looks like when computing the intrinsic size of the flex item, Firefox is not consider the percentage basis of the flex container. Bug 1909761 might help fixing this bug.

Status: UNCONFIRMED → NEW
Depends on: 1909761
Ever confirmed: true

After debugging the testcase, I discovered that this bug is similar to bug 1742042. We'll need to apply the stretched cross-size when computing the flex item's intrinsic size.

The workaround for the testcase is to add height:100% on the flex item.

See Also: → 1742042

This is fixed by bug 1742042.

Status: NEW → RESOLVED
Closed: 8 months ago
Duplicate of bug: 1742042
Resolution: --- → DUPLICATE
See Also: 1742042
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: