w3c / w3c/csswg-drafts

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

Open
#8,028 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

scroll-animations-2
Dominant language
Bikeshed
Stars
4.9k
Forks
816
PR merge metrics
PR metrics pending

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read the linked Scroll-linked Animations and CSS Scoping specifications, along with issue #5809, to understand the existing naming and scoping proposals. Done would require a resolved standards direction on whether and how @scope and select() should be integrated, rather than a narrowly defined code change.

Written by the indexing model from the issue text.

Assessment

Tech stack
css
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.