E46D [scroll-animations-1] Allow Anonymous Scroll Progress Timelines to target self · Issue #8227 · w3c/csswg-drafts · GitHub
[go: up one dir, main page]

Skip to content

[scroll-animations-1] Allow Anonymous Scroll Progress Timelines to target self #8227

@bramus

Description

@bramus

When creating an Anonymous Scroll Progress Timelines usning scroll() you can target either the root or the nearest scroller.

Currently nearest is defined as:

Specifies to use the nearest ancestor scroll container. (Default.)

This does not allow authors to create an Anonymous Scroll Progress Timeline that uses the element itself, as nearest only looks to ancestors. E.g. the code below does not work when .container is the scroller

.container {
  animation: 1s bg-scale both linear;
  animation-timeline: scroll(nearest inline);
}

As a result, authors must use a named Scroll Progress Timeline instead:

.container {
  animation: 1s bg-scale both linear;
  scroll-timeline: --self inline;
  animation-timeline: --self;
}

This seems like a bit a hassle. Can we adjust nearest so that it starts looking from the targeted element itself first, and only then to ancestors? Or maybe introduce a new keyword self should altering nearest introduce some nasty side-effects?

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

      0