- From: Mason Freed via GitHub <noreply@w3.org>
- Date: Tue, 29 Jul 2025 16:52:59 +0000
- To: public-css-archive@w3.org
> It's natural to think of animation triggers as inherently a matched pair -- one to start the animation, another to stop -- but we have to be careful when applying that model to event-based triggers. Matching `mousedown` and `mouseup` events is intuitive, but we should avoid the temptation to think this is equivalent to `:active` via other means. I just wanted to +1 this comment - this API shouldn't be stateful, to avoid all kinds of problems. Which leads me to one observation, gleaned from the interest invokers discussion: > Here's some suggestions for the matrix, based on David's ideas and expanded a little > > Keyword Initial Playing Paused Finished > `play-alternate` play() Negates playback rate play() Negates playback rate, play() > `play-pause` play() pause() play() play() > `restart` play() set progress to 0 set progress to 0, play() set progress to 0, play() I'm not sure keywords like these should be allowed, because they roughly imply statefulness. The risk is that the "state" gets out of sync. As an example, let's say you have `animation-trigger-action: play-pause;`, and you have that triggered by both `mousedown` and `mouseup`. The expectation is that this will play the animation when you mousedown, and stop playing when you mouseup. But you run into issues if the animation state can change via other means. If, for example, you mousedown and the animation starts playing. Then, before you mouseup, the animation hits the end and stops playing on its own. In this case, very unintuitive things happen. Releasing the mouse in this case restarts the animation. And now it's playing, so mousedown will stop it again. But then you're stuck. The only way to release the mouse and have a non-playing animation is to wait, with the mouse down, until the animation hits the end again. -- GitHub Notification of comment by mfreed7 Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/12336#issuecomment-3133323714 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Tuesday, 29 July 2025 16:53:00 UTC