Skip to content

[css-overflow] Overflow propagation when the element propagated from is display: none #3779

Closed

Description

@emilio

https://drafts.csswg.org/css-overflow/#overflow-propagation says that some overflow properties should be propagated to the viewport from the html or body element:

However this happens regardless of the display value of the document element or the body. For example, the following examples show scrollbars:

  • data:text/html,<html style="display: none"><body style="overflow: scroll">
  • data:text/html,<html style="display: none; overflow: scroll">

This is the only case where Gecko needs to resolve a style in a display: none subtree for rendering (apart of getComputedStyle), and I find it somewhat silly.

Seems enough of an edge-case that could probably be changed. I wonder if there would be interest from other vendors in doing this change?

cc @lilles

Activity

  1. emilio commented on Mar 29, 2019

    @emilio
    CollaboratorAuthor

    Basically, my point is that this should be closer to the background style propagation, which only happens if the document element is actually displayed.

  2. fantasai commented on Mar 29, 2019

    @fantasai
    Collaborator

    I think from an author standpoint this case doesn't matter, so personally I don't care. Happy to do whatever is expedient for implementers.

  3. lilles commented on Mar 31, 2019

    @lilles
    Member

    Fine for us from an implementation pov.

  4. lilles commented on Mar 31, 2019

    @lilles
    Member

    Chrome even propagates the background, which is not according to spec.

  5. lilles commented on Mar 31, 2019

    @lilles
    Member
  6. lilles commented on Apr 1, 2019

    @lilles
    Member

    There is the same issue for https://drafts.csswg.org/css-writing-modes-3/#principal-flow

    Chrome starts with the horizontal scrollbar to the right for direction:rtl regardless of display:none or not on body below.

    <!DOCTYPE html>
    <style>
      html { overflow: scroll; width: 5000px; height: 100px }
      body { direction: rtl; display: none }
    </style>
    <body></body>
    
  7. css-meeting-bot commented on Apr 10, 2019

    @css-meeting-bot
    Member

    The CSS Working Group just discussed Overflow propagation when the element propagated from is display: none, and agreed to the following:

    • RESOLVED: Do not propagate any style from display:none HTML or Body
    The full IRC log of that discussion <dael> Topic: Overflow propagation when the element propagated from is display: none
    <dael> github: https://github.com//issues/3779
    <dael> plinss: Who wants this one?
    <dael> fantasai: Was emilio able to join?
    <dael> emilio: Hey
    <dael> emilio: This is mostly a little thing and only place where gecko needs to deep dive into the subtree to render
    <dael> emilio: I remember rune at some point complained about it. I was wondering if people had willingness to change. I don't deeply care but I think it's a bitsaner
    <dael> AmeliaBR: You're asking if the HTML or Body element isn't displayed we don't worry about prop. styles up?
    <dael> emilio: Yes
    <dael> plinss: Just get a blank page?
    <bkardell_> seems fine?
    <dael> smfr: display:none is common to do?
    <dael> emilio: I dont think it is. I could get some data and come back
    <dael> smfr: My only concerns is sites where they do that and browsers prop. the body background and you get a flash of color change
    <dael> emilio: Body background is spec to not prop if there's display:none
    <dael> smfr: I guess Chrome has a bug that it doesn't do that which is shared by WK
    <dael> emilio: Def Chrome, I don't know WK
    <dael> smfr: Prob does. I don't feel too strongly. Seems reasonable
    <dael> plinss: Curiousabout usage of display:none body. I can see it abused for tracking iframes and whatnot on a page. Curious if that's something people want to do.I guess if they're putting in iframe they won't put a bg on it
    <bkardell_> but changing -- there isn't interop now -- or is there?
    <dael> plinss: Prop: Not prop any style from display:none HTML or Body
    <dael> emilio: Don't propagate the background of the element...basically whatever definition the background propagation is using I want to align
    <dael> plinss: Objections?
    <dael> RESOLVED: Do not propagate any style from display:none HTML or Body
  8. 15 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions