[csswg-drafts] [web-animations-2]Playing an animation might return too early when auto-aligning start time (#9871)

johannesodland has just created a new issue for https://github.com/w3c/csswg-drafts:

== [web-animations-2]Playing an animation might return too early when auto-aligning start time ==
It seems to me that [`playing an animation`](https://drafts.csswg.org/web-animations-2/#playing-an-animation-section) is returning too early when auto-aligning start time due to a finite timeline.

Given the following code, playing an animation seems to return on step 10.
```js
const viewTimeline = new ViewTimeline({ subject, axis});
const effect = new KeyframeEffect(subject, [{ opacity: 1}, { opacity: 0}], { duration: 'auto', fill: 'both' });
const animation = new Animation(effect, viewTimeline);
animation.play();
```

Step 10 in [Playing an animation](https://drafts.csswg.org/web-animations-2/#playing-an-animation-section) states:

> 10. If the following three conditions are all satisfied:
>
> - animation’s [hold time](https://drafts.csswg.org/web-animations-1/#animation-hold-time) is [unresolved](https://drafts.csswg.org/web-animations-1/#unresolved), and
> - aborted pause is false, and
> - animation does not have a [pending playback rate](https://drafts.csswg.org/web-animations-1/#pending-playback-rate),
>
> abort this procedure.


At this point the procedure aborts as the hold time is not resolved, aborted pause is false and animation does not have a pending playback rate.

The animation does not have a ready promise nor a pending play task as this is first created on step 11 and 12.

As a result, the [play state](https://drafts.csswg.org/web-animations-1/#play-states) is still `idle` due to having an unresolved current time, having an unresolved start time and no pending play task.

This again causes [`Auto-aligning the start time`](https://drafts.csswg.org/web-animations-2/#auto-aligning-start-time) to abort on step 3

> 3. If [play state](https://drafts.csswg.org/web-animations-1/#animation-play-state) is idle, abort this procedure.


I'm not sure what the correct solution is here, and I might be reading the spec wrong. Maybe step 10 should check that the `auto align start time` flag is not set? Or that the start time is set?

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/9871 using your GitHub account


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

Received on Saturday, 27 January 2024 16:51:12 UTC