Skip to content

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

@Loirooriol

Description

@Loirooriol

https://drafts.csswg.org/css-overflow-3/#overflow-propagation

UAs must apply the overflow-* values set on the root element to the viewport when the root element’s display value is not none. However, when the root element is an [HTML] <html> element (including XML syntax for HTML) whose overflow value is visible (in both axes), and that element has as a child a <body> 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.

<!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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions