Re: [csswg-drafts] [css-animations-2] Move scroll and event animation triggers to independent namespace (#12336)

> I think the new direction, where we declaring "actions" rather than "behaviors", gives us stateless triggers, and I think this agrees with @fantasai's earlier https://github.com/w3c/csswg-drafts/issues/12336#:~:text=this%20makes%20them%20stateless. Tab's table seems to me to be a more elaborate specification of the trigger behavior Stefan was describing in his [PR](https://github.com/w3c/csswg-drafts/pull/12314/files#r2145827252), except now this statelessness applies not only to event triggers but also to timeline triggers (ignoring timeline state which is quite a separate thing).

I have to admit I got a little lost with @flackr's [comment](https://github.com/w3c/csswg-drafts/issues/12336#issuecomment-3133075898), but what @DavMila said plus his example, I think that's good way forward, though I'm concerned we're making the API a bit overwhelming, and I think the culprit is my spec text, that should have been more like "play forward on entry; play backwards on exit", rather than something more naive like "reverse on each boundary cross".

------

I might be derailing the conversation here (sorry 🙈), but @flackr's thoughts also gave me another idea. What if we removed timeline triggers altogether? Then we only deal with stateless events, and we don't have to differentiate them from another thing, and it should complicate the rest.
What if we actually had a `viewenter` and `viewleave` DOM events which map exactly to what `view()` does, but without the state? (And I must say I think I'd love to have those anyway).
The only thing that we'd be missing is ranges - which we ought to keep - so probably imagine these would go in the `options` object if set programmatically, like: `.addEventListener('viewenter', (e) => {...}, { range: 'contain' })`.
After all, with the upcoming `pointer()` timeline we may as well settle for just using `pointerenter` and `pointerleave` events.

-- 
GitHub Notification of comment by ydaniv
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/12336#issuecomment-3152479346 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Monday, 4 August 2025 21:39:13 UTC