Skip to content

[css-overflow] Should the viewport accept overflow: clip? #12687

Open

Description

@Loirooriol

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

If clip is applied to the viewport, it must be interpreted as hidden.

However, I wonder if we should revisit this because of the same arguments from #12289. That is, the author may want to disable scrolling, but if there is some content slightly overflowing, then calls to scrollIntoView or anchor link scrolls can accidentally scroll to the overflowing content. Worse yet, a user has no way to undo this after it happens.

Activity

  1. jonjohnjohnson commented on Aug 30, 2025

    @jonjohnjohnson

    Also, see #3953

  2. changed the title [-][css-overflow] Should the viewport accept `overflow: clip ?[/-] [+][css-overflow] Should the viewport accept `overflow: clip`?[/+] on Aug 31, 2025
  3. benface commented on Sep 2, 2025

    @benface

    I've definitely been bitten by the current behavior when trying to ensure the viewport would never accidentally become horizontally scrollable, so if this is web compatible, big +1 from me.

  4. css-meeting-bot commented on Dec 10, 2025

    @css-meeting-bot
    Member

    The CSS Working Group just discussed [css-overflow] Should the viewport accept `overflow: clip`?.

    The full IRC log of that discussion <ydaniv> oriol: in some other issue we resolved that it should be possible for scroll containers to only be scollable in one axis and other to be clip
    <ydaniv> ... common for authors that only want to allow in one axis
    <ydaniv> ... and then in other axis they used hidden, or clip
    <ydaniv> ... what could happen, some JS APIs could scroll there and get broken
    <ydaniv> ... we resolved to allow one axis to be clip
    <ydaniv> ... currently the logic that propagates the overflow value to the viewport...
    <emilio> q+
    <smfr> q+
    <ydaniv> ... to be consistent we should allow one of the axes to be clip, or both for completeness
    <Rossen3> ack emilio
    <ydaniv> emilio: to be clear, you're not proposing to avoid having a scroll container on the root, just to be able to scroll in one axis
    <ydaniv> oriol: the CSS2 part, keeping it as scroll container with one axis not scrollable
    <ydaniv> ... we can keep both things, allow authors to specify one axis not scrollable
    <TabAtkins> +1 to Oriol's suggestion. Being able to *accidentally* scroll into off-screen content (but then never having the ability to get back) sucks; the difference between clip and hidden here is just the behavior in certain corner cases, and 'clip' is better there.
    <ydaniv> ... for consistency with what we did for elements, we should allow for 1 of the axes to be clipped, that we should consider
    <Rossen3> ack smfr
    <emilio> q+
    <ydaniv> smfr: the root scroller is somewhat special
    <ydaniv> ... if someone would do that on the root they could break navigations
    <ydaniv> ... might not be a blocker, but need to keep in mind
    <Rossen3> ack emilio
    <ydaniv> emilio: I think my concern on root not having a scroller is that overflow visible would still create a scroller
    <ydaniv> ... if we decide that clip propegates, we should say it still creates a scroll container
    <smfr> q+
    <ydaniv> ... it does affect APIs, and what scrolling element to return
    <Rossen3> q+
    <Rossen3> acl smfr
    <Rossen3> ack smfr
    <ydaniv> smfr: does that affect the behavior of scrollWidth/Height?
    <ydaniv> emilio: that's what I wanted to get at
    <ydaniv> ... for overflow: clip shouldn't create a scrollable element
    <ydaniv> ... I think that scrollParent would be skipped
    <ydaniv> smfr: so going up the tree and not hitting the root would be strange
    <ydaniv> oriol: we can say that if both axes are set to clip then hit that
    <ydaniv> Rossen3: does that also include selection?
    <ydaniv> ... mostly for a11y
    <Rossen3> ack Rossen3
    <Rossen3> ack Rossen
    <ydaniv> oriol: I guess it could be same as elements that only scroll in one axis
    <ydaniv> ... I'd say that probably [missed]
    <emilio> Wanted to say that preventing both axes from scrolling seems fine as long as we keep saying that the viewport is a scroller
    <ydaniv> Rossen3: not quite ready for a resolution
    <ydaniv> ... but made some progress, so back to the issue
    <ydaniv> ... we can continue next week if we have progress on the issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    css-overflow-3

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions