[csswg-drafts] [css2] min/max-height and margin collapse is not interoperable (#8919)

Loirooriol has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css2] min/max-height and margin collapse is not interoperable ==
https://drafts.csswg.org/css2/#collapsing-margins

> bottom margin of a last in-flow child and bottom margin of its parent if the parent has [auto](https://drafts.csswg.org/css2/#valdef-height-auto) computed height

> Note the above rules imply that:
> - The bottom margin of an in-flow block box with a [height](https://drafts.csswg.org/css2/#propdef-height) of [auto](https://drafts.csswg.org/css2/#valdef-height-auto) and a [min-height](https://drafts.csswg.org/css2/#propdef-min-height) of zero collapses with its last in-flow block-level child’s bottom margin if the box has no bottom padding and no bottom border and the child’s bottom margin does not collapse with a top margin that has clearance.

The note mentions a requirement for `min-height: 0`, where does this come from? The normative text only mentions `min-height` for a different case.

Testcase: https://software.hixie.ch/utilities/js/live-dom-viewer/saved/11745

 - Gecko and Blink collapse as long as `min-height` doesn't increase the height.
 - WebKit collapses regardless of `min-height`.

What about `max-height`? https://software.hixie.ch/utilities/js/live-dom-viewer/saved/11746

 - Gecko and Blink collapse as long as `max-height` doesn't decrease the height.
 - WebKit collapses regardless of `max-height`.

Worth noting that there is also this other case:

> top and bottom margins of a box that does not establish a new block formatting context and that has zero computed [min-height](https://drafts.csswg.org/css2/#propdef-min-height), zero or [auto](https://drafts.csswg.org/css2/#valdef-height-auto) computed [height](https://drafts.csswg.org/css2/#propdef-height), and no in-flow children

Testcase: https://software.hixie.ch/utilities/js/live-dom-viewer/?saved=11751

| Collapses                       |Spec|Gecko|Blink|WebKit|
| ------------------------------- | -- | --- | --- | ---- |
| `height: 1px; max-height: 0px`  | ❌ | ❌  | ✔️  | ❌  |
| `height: 100%` (indefinite)     | ❌ | ❌  | ✔️  | ✔️  |
| `min-height: 100%` (indefinite) | ❌ | ❌  | ✔️  | ❌  |


Should the spec change to align with some browser? At least remove the spurious `min-height: 0` from the note, or enforce it in the normative text.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/8919 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 6 June 2023 09:32:33 UTC