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

> I understand the motivation behind saying that triggers are not directly associated with elements, but I think that might not really be true as a consequence of our [decision](https://github.com/w3c/csswg-drafts/issues/12119#issuecomment-2985057242) that triggers are a separate entity from animations. I think triggers actually have their identity more closely linked with the element providing the timeline (or events in the case of event-based triggers) than with the animation they happen to be attached to at any point in time. A trigger with a different underlying element is simply not the same trigger. The same trigger may be attached to a different animation. The same trigger may be attached to multiple animations (though we haven't settled on [what to call that method](https://github.com/w3c/csswg-drafts/issues/12397)). Without independent namespaces, I don't think you can do this is in CSS, even though you can do it in JS, which speaks to a concern you had about divergent JS and CSS capabilities on the issue about multiple triggers per animation.
> 
> ... which brings me to the other thing about our proposal: even though we might not spec having multiple triggers per-animation for the moment, independent namespaces gives us an easy and natural way to do that in the future, ie space-separated lists of named triggers, e.g:
> 
> ```
> .content1 {
>   timeline-trigger: --trigger1 view() alternate;
> }
> .content2 {
>   timeline-trigger: --trigger2 view() alternate;
> }
> .animatable {
>   animation: glow;
>   animation-trigger: --trigger1 --trigger2;
> }
> ```

Just want to underscore this point. It might be awkward/unusual to have multiple timeline-based triggers attached to a single animation, but this seems like a much more natural and useful feature for event-based triggers. Consider a silly example like [cookie-clicker](https://orteil.dashnet.org/cookieclicker/), where there could be multiple click targets that all trigger the same animation; or maybe click targets and also keypress targets. Because event-based triggers are stateless, the behavior of multiple triggers attached to a single animation is coherent and well-defined.

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


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

Received on Thursday, 17 July 2025 21:22:40 UTC