[csswg-drafts] [css-overflow] Viewport's `overflow` is not propagated from the `<body>` if it has `display: contents` (#12643)

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

== [css-overflow] Viewport's `overflow` is not propagated from the `<body>` if it has `display: contents` ==
https://drafts.csswg.org/css-overflow-3/#overflow-propagation

> UAs must apply the `overflow-*` values set on the root element to the [viewport](https://w3c.github.io/epub-specs/epub33/core/#dfn-viewport) when the root element’s [`display`](https://drafts.csswg.org/css-display-3/#propdef-display) value is not [`none`](https://drafts.csswg.org/css-display-4/#valdef-display-none). However, when the root element is an [[HTML]](https://drafts.csswg.org/css-overflow-3/#biblio-html) [`<html>`](https://html.spec.whatwg.org/multipage/semantics.html#the-html-element) element (including [XML syntax for HTML](https://html.spec.whatwg.org/multipage/introduction.html#html-vs-xhtml)) whose [`overflow`](https://drafts.csswg.org/css-overflow-3/#propdef-overflow) value is [`visible`](https://drafts.csswg.org/css-overflow-3/#valdef-overflow-visible) (in both axes), and that element has as a child a [`<body>`](https://html.spec.whatwg.org/multipage/sections.html#the-body-element) element whose `display` value is also not `none`, user agents must instead apply the `overflow-*` values of the first such child element to the viewport.

```html
<!DOCTYPE html>
<html style="border: solid; height: 200vh; margin: 1em">
<body style="display: contents; overflow: hidden">
```

Blink, WebKit and Gecko agree: the viewport has scrollbars despite the body having `overflow: hidden`.

Note this isn't a problem on the root, since there `display: contents` computes to `block` (https://drafts.csswg.org/css-display-4/#root).


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


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

Received on Friday, 22 August 2025 21:04:22 UTC