Open Bug 1436180 Opened 7 years ago Updated 2 years ago

[css-grid][flex]Intrinsic size on grid-subflex / subbitem keeps the image width whilst image is resized.

Categories

(Core :: Layout: Grid, defect, P3)

defect

Tracking

()

Webcompat Priority P3
Tracking Status
firefox60 --- affected

People

(Reporter: hunboy, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Attached file testcase with a constant cell height. (deleted) —
Motivation: some horizontally scrollable slider by flex in a grid cell. AR: The resized <img> allocates the original size of the image. ER: Like this fiddle: https://jsfiddle.net/9eb69gye/16/ but images might be in a wrapper. Although the image resized to the grid-cell's height, still allocates the original image width in the cell. Crossbrowser compat: chromium looks ok by decreasing the width, although has other bug, scrollbar overlaps the content in Win10. Testcase attached. in the testcase the grid cell is sized to 100px, but should be work with 1fr value as well.
Priority: -- → P3
I'm betting that something like this is what's going on here: (a) the flexbox (#slides) isn't considering its height to be "definite", so it doesn't proactively stretch (shrink) its items (the images) in the cross axis. (b) ...so we resolve the items' main size to be the image's intrinsic size (kinda under the assumption that the image will actually get its inrinsic height) (c) ...but then in the final layout, it turns out the flex container *does* have a constrained height after all, so the images do as well, so their width is constrained. But we've already determined their x-positions without that knowledge. This is likely related to the spec change (or at least the spec text) in bug 1055354. Probably best to fix this as part of sorting that issue out. Marking as dependency.
Depends on: 1055354

I think I'm running into this issue as well, see https://codesandbox.io/s/cool-yalow-kcfdq
The idea is that I want to maintain an aspect ratio of 1/1 which img should do with an explicit height set, and does in other places.
An interesting part to this is that if I inspect the dom and hover the SizeHelper img, it shows the correct size, but the grid has not responded in kind.
Sorry if I'm in the wrong ticket, it's a little hard to tell what's going on. I was torn between this one and https://bugzilla.mozilla.org/show_bug.cgi?id=1439527

Webcompat Priority: --- → ?
Webcompat Priority: ? → P3
Blocks: 1788981
Severity: normal → S3
Component: Layout → Layout: Grid
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: