Re: [csswg-drafts] [web-animations-2][css-animations-2] Set of actions for animation triggers (#12611)

Talked with @ydaniv and @flackr offline and we have agreed to use the keywords in the [table above](https://github.com/w3c/csswg-drafts/issues/12611#issuecomment-3292998336).

The **proposal** we want to resolve on is this: `animation-trigger` specifies the behavior of triggers using the keywords in the [table above](https://github.com/w3c/csswg-drafts/issues/12611#issuecomment-3292998336).

For completeness, here is the proposed syntax in full:

`animation-trigger: [ [ <dashed-ident> <enter-behavior> [<exit-behavior>] ]+ ]#`

where:
- `<enter-behavior>` and `<exit behavior>` are each declared using one of the keywords in the table.
- `<exit-behavior>` is optional and is `none` when omitted.

---

Additionally, we considered supporting `auto` as a keyword for the `<exit-behavior>`. `auto` would mean "same as \<enter-behavior\>". As such, we propose the following:

- add `auto` to the list of \<exit-behavior\> keywords, meaning "same as \<enter-behavior\>", and
- let \<exit-behavior\> default to `auto`

The benefit of setting `auto` as the default `<exit-behavior>` is that in some cases it simplifies what authors need to specify. I'll describe how `auto` affects the higher-level [behaviors](https://drafts.csswg.org/web-animations-2/#trigger-behaviors) we hope to keep support for:
- **Once** is achieved with `animation-trigger: --trigger play-once` - this behavior remains unchanged,
- **Repeat** is achieved with `animation-trigger: --trigger play reset` which, since it specifies the exit keyword, keeps the behavior unchanged,
- **Alternate** is achieved with `animation-trigger: --trigger play-forwards play-backwards` but, with the `auto` modification, can be simplified to `animation-trigger: play-alternate`,
- **State** is achieved with `animation-trigger: --trigger play pause` which, since it specifies the exit keyword, keeps the behavior unchanged,

 The caveat is that in some cases, having the \<exit-behavior\> mirror the \<enter behavior\> may not be desirable, e.g. `animation-trigger: --timeline-trigger play` is perhaps not intended to `play()` on exit.
However, we think this is mitigated because:
1. most use cases likely fall into the categories described above, and
2. this case is easily fixed with `animation-trigger: --timeline-trigger play none`

cc @ydaniv @flackr on any correction in the `auto` proposal.


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


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

Received on Monday, 6 October 2025 18:08:18 UTC