Re: [csswg-drafts] [scroll-animations][web-animations-2] rewinding a finished scroll-driven animation and playing it again (#11270)

So, going back to the [WPT test in question](https://github.com/web-platform-tests/wpt/blob/7e168195e3629f88bef6293c18ae8674f90893fd/scroll-animations/scroll-timelines/updating-the-finished-state.html#L502):

```javascript
async_test(t => {
  const animation = createScrollLinkedAnimation(t);
  const scroller = animation.timeline.source;
  const maxScroll = scroller.scrollHeight - scroller.clientHeight;

  animation.play();

  animation.onfinish = event => {
    scroller.scrollTop = 0;
    window.requestAnimationFrame(function() {
      animation.play();
      scroller.scrollTop = maxScroll;
      animation.onfinish = event => {
        t.done();
      };
    });
  };
  scroller.scrollTop = maxScroll;
}, 'Animation finish event is fired again after replaying from start');
```

There's still something fishy here because we never get in a situation where the timeline is seeked back to 0%. I expect the intent of the `requestAnimationFrame` call is to delay the `play()` and `scroller.scrollTop = maxScroll` calls to the _next_ frame, but since the `finish` event is dispatched at the end of the _update animation and send events_ procedure, which happens before `requestAnimationFrame` callbacks are serviced, this all happens in the same frame.

@kevers-google and @ogerchikov : `git blame` says you authored parts of this test, what do you make of this?

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


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

Received on Monday, 25 November 2024 20:32:54 UTC