Skip to content

[css-contain][css-scroll-anchoring] Scroll into view adjustments for content-visibility: auto #9833

Open

Description

@flackr

In issue #9337 we resolved that the target of a scroll into view would be considered relevant in order to accurately measure the location being scrolled into view. While this works (more or less) for instantaneous scrolls or simple cases, if a smooth scroll is being performed there are likely to be elements revealed during the scroll that may result in the end location being incorrect.

E.g. In this demo the contain-intrinsic-size is an under-estimate for the real size. When we start the scroll, the destination scroll offset is calculated based on all of the children between the current location and the target being their contain-intrinsic-size but as the scroll progresses their real size is used and the target location moves further away. As a result the scroll does not scroll far enough.

I suspect that we need a more generic solution to this problem. The simplest may be if the target scroll position were also subject to scroll anchoring.

Activity

  1. fabiospampinato commented on Nov 26, 2024

    @fabiospampinato

    This is a pretty annoying issue that throws at wrench of the performance benefits of "content-visibility". If I need to scroll to an element inside a "content-visibility: auto" as one of the features of my app suddenly that becomes a problem right away, a problem that the browser is uniquely equipped to solve when .scrollIntoView is called, but that it currently isn't solving, which should be fixed, imo.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions