Skip to content

[scroll-animations-2] consider [css-scoping] / @scope + select() for referencing scroller #8028

Description

@Schepp

With more and more CSS features relying on somehow "tagging" elements for later reference, like in Scroll-linked Animations, and each time introducing new tagging vocabulary and mechanisms of their own, I wonder if it would make more sense to build upon @mirisuzanne's idea of css-scoping / issue #5809 / CSS Scoping and combine that with the previously used select() function?

So instead of writing this:

.scroll-container {
  scroll-timeline-name: foo;
}

.animated-sibling-or-child-of-scroll-container {
  animation-timeline: foo;
}

we could have this:

@scope(.ancestor-of-both) {
  .animated-sibling-or-child-of-scroll-container {
    animation-timeline: scroll(select(:scope .scroll-container));
  }
}

Drawback of this would be that another not even started idea/spec would block the finalization of this one (and potential others). A solution could be to release Scroll-linked Animations the way it is currently planned and to upgrade it later to also support a CSS Scoping aware select() function for referencing the scroll container.

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