8000 [css-overflow] Viewport's overflow is not defined when the root has `display: none` · Issue #12649 · w3c/csswg-drafts · GitHub
[go: up one dir, main page]

Skip to content

[css-overflow] Viewport's overflow is not defined when the root has display: none #12649

@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.

The spec is clear that we don't propagate from the root element in that case.

The spec could be interpreted as still allowing to propagate from the <body> (being in a display: none subtree doesn't mean that it has display: none itself), but no browser does that, as seen here:

<!DOCTYPE html>
<html style="display: none">
<style>
::-webkit-scrollbar { background-color: #eff0f1; width: 12px; height: 12px; }
::-webkit-scrollbar-thumb { background: #898c8d }
</style>
<body style="overflow: scroll">

Regardless, if both the root and the body have display: none, the spec is clear that we don't propagate from either of them.
So what overflow does the viewport use?

The obvious choice is the initial overflow: visible, which will behave as auto:

If visible is applied to the viewport, it must be interpreted as auto.

Since there is no box, it's hard to tell if browsers are using visible/auto or clip/hidden. Nobody uses scroll, though.

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

      0