Skip to content

[css-contain][css-sizing] ScrollIntoView a descendant of element with content-visibility:auto #9337

@cathiechen

Description

@cathiechen

In [1], point 5 defines the behavior of scrollIntoView targeting on an element with content-visibility:auto.

For the purposes of scrolling operations, such as scrollIntoView(), an element with content-visibility: auto that is skipping its contents has its size and location determined with size containment still active.

However, it does not mention the behavior of scrollIntoView targeting on a descendant with content-visibility:auto. Tested in Chromium and WebKit, the content-visibility:auto is treated as visible before scrolling, it makes sense to me. The related test cases are content-visibility-075.html and content-visibility-076.html.
Should we make it clear in the specification? Maybe something like this?

  1. Before scrolling, if the element with c-v: auto has descendant as the target of scrolling, change the relevancy to visible, so that the element could be laid out as if it were relevancy to user. Here we could add a test with nested c-v auto, see test
    content-visibility-vs-scrollIntoView-001.html
    in the FireFox patch.
  2. Performance scrolling.
  3. After scrolling, we need to check the relevancy again in the intersection observer, if the element with c-v auto is not visible, we should hide its content again. This could happen if there is overflow: clip. See test case
    content-visibility-vs-scrollIntoView-002.html
    in the FireFox patch.

@emilio @vmpstr @rwlbuis WDYT?

[1] https://drafts.csswg.org/css-contain-2/#cv-notes

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