Closed bramus closed 1 year ago
@bramus Do you have any ideas about which of re-using nearest
or having a separate self
keyword would be more helpful / less confusing / more ergonomic for authors?
I'd prefer adding self. This leaves which scroller is observed by nearest
consistent with view-timeline, sticky position, etc.
Thinking things a bit through, I’m also in favor of adding self
instead of altering how nearest
works. That way authors can have an element both respond to its parent and its own scroll-position. Depending on the use-case, an author might prefer one or the other, so giving them control over it seems reasonable.
Linked to that, I would propose that the default value to remains nearest
, for reasons flackr@ listed just above.
Proposed resolution: Add self
as a value for <scroller>
. Keep nearest
as the default value.
The CSS Working Group just discussed [scroll-animations-1] Allow Anonymous Scroll Progress Timelines to target self
, and agreed to the following:
RESOLVED: add a `self` keyword
When creating an Anonymous Scroll Progress Timelines usning
scroll()
you can target either theroot
or thenearest
scroller.Currently
nearest
is defined as: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 scrollerAs a result, authors must use a named Scroll Progress Timeline instead:
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 keywordself
should alteringnearest
introduce some nasty side-effects?