Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable effect without cancelling animation #179

Conversation

johannesodland
Copy link
Contributor

If the timeline is inactive, the current implementation disables the effect by cancelling the underlying animation.
This can cause issues. If the animation is later cancelled "for real" the animation is already idle and no cancel event will be emitted.

One example of code that is affected is the WPT subtest 'oncancel event is fired when the timeline is inactive.' in cancel-animation.html.

  await waitForNextFrame();
  animation.play();
  await animation.ready;

  // Make the scroll timeline inactive.
  scroller.style.overflow = 'visible';
  scroller.scrollTop;
  await waitForNextFrame();
  // If the polyfill listens for style changes, the timeline should be inactive by this point.
  assert_equals(animation.timeline.currentTime, null,
                'Sanity check the timeline is inactive.');

  const eventWatcher = new EventWatcher(t, animation, 'cancel');
  animation.cancel();
  const cancelEvent = await eventWatcher.wait_for('cancel');
  // Cancel event will not be emitted, and we will never reach code below this point.

This test will time out if the timeline is updated when the source style is changed.
The polyfill currently don't detect style changes, and fails at the sanity check,
but in the future (PR #177) I expect that we will react to style changes.

This PR tries to work around the issue by temporary removing the effect, instead of cancelling the animation, when the timeline is inactive.

@johannesodland johannesodland changed the title Disable effect without cancelling Disable effect without cancelling animation Nov 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant