Closed Bug 1794040 Opened 3 years ago Closed 3 years ago

adding container-type: inline-size to an element, makes the height of that element 0px

Categories

(Core :: CSS Parsing and Computation, defect)

Firefox 107
x86_64
macOS
defect

Tracking

()

RESOLVED FIXED
108 Branch
Tracking Status
firefox108 --- fixed

People

(Reporter: o.zwagers, Assigned: emilio)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:105.0) Gecko/20100101 Firefox/105.0

Steps to reproduce:

I am using the experimental feature "layout.css.container-queries.enabled". In my css I have added the property container-type to an parent element with the value "inline-size". However that parent element's height becomes 0, even though there are children inside the parent with a height larger than 0. In other browser (safari and chrome), the height of children is used to determine the size of the parent.

so to replicate this issue:

  • style a div element and give it the class parent. add the css property container-type to the parent element.
  • in your html, add children to the parent, which have a height.
  • look in the devtools and check the height of the parent element.

Actual results:

the parent element's height got removed when using the css property container-type, with the value "inline-size".

Expected results:

while using inline-size, I expect that the height of the parent will get a size so it can fit the children.

please contact me if something is unclear.

Is it possible to provide a test case to make sure we are using the same case in order to confirm the issue?
Thanks.

Flags: needinfo?(o.zwagers)
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <style>

        .parent {
            container-type: inline-size;
        }

    </style>

</head>
<body>
    <div class="parent">
        <h3>Hello World</h3>
    </div>
</body>
</html>

Here the parent class will have the height 0px when using container-type with the value inline-size. However you would expect it to be the same height as the h3 element (19px). When I remove the parent class from the div element, the height becomes the same as the height of the h3 element.

I hope this is what you meant with test case.

Flags: needinfo?(o.zwagers)
Status: UNCONFIRMED → NEW
Component: Untriaged → CSS Parsing and Computation
Ever confirmed: true
OS: Unspecified → macOS
Product: Firefox → Core
Hardware: Unspecified → x86_64

It was made a bitfield so that we could include style. But then style
containment was removed and the bitfield keeps causing us to do wrong
check (since INLINE_SIZE intersects SIZE).

So just make it an enum. This causes a progression and a test that
failed now times out (which is a pre-existing issue, just like the
pseudo-elements test that times out).

Assignee: nobody → emilio
Status: NEW → ASSIGNED
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/bee94ed5a33d Simplify container-type implementation. r=dshin

Backed out changeset bee94ed5a33d (Bug 1794040) for causing wpt failures on container-type-containment.html.
Backout link
Push with failures <--> wpt11
Failure Log

Flags: needinfo?(emilio)
Flags: needinfo?(emilio)
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/60960388df11 Simplify container-type implementation. r=dshin
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 108 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: