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

[web-animations-1] Does an animation have pending events? #8004

Open
jakearchibald opened this issue Nov 3, 2022 · 5 comments
Open

[web-animations-1] Does an animation have pending events? #8004

jakearchibald opened this issue Nov 3, 2022 · 5 comments

Comments

@jakearchibald
Copy link
Contributor

In the view transitions spec we want to know when all animations targeting particular elements are finished/idle. However, we want to wait long enough so an additional animation can be changed in the "finish" event or .finished promise reaction callback.

We currently have prose like:

If |document|'s [=pending animation event queue=] has any events associated with |animation|.

But that seems a bit hand-wavy, since the queue isn't really defined. It stores event objects, but also kinda animations too?

I'm not sure what the right way forward here is. Maybe the animation spec could include a "has pending events" definition and export that?

@birtles
Copy link
Contributor

birtles commented Nov 3, 2022

Hi @jakearchibald, what's missing in the definition of the queue?

@jakearchibald
Copy link
Contributor Author

IMO:

It shouldn't be called a queue unless the items are in the right order. So, either call it "pending animation events", make it a list, and note that it's out of order, or call it "pending animation events queue", a queue, and insert items in the correct order.

The items should be a defined struct, so the event object and target of a pending animation event can be referenced.

Happy to make a PR.

@birtles
Copy link
Contributor

birtles commented Nov 4, 2022

Because the events get sorted again before being dispatched? So it's more like a pending events bucket? That's a fair point. I'll try to have a proper look tomorrow.

@jakearchibald
Copy link
Contributor Author

I'm being pretty nitpicky I think, so I don't think this is high priority.

@birtles
Copy link
Contributor

birtles commented Nov 5, 2022

So my understanding of what is required here:

  • Refer to a list instead of a queue, since, although order is important (we do a stable sort), we do more than just queuing and dequeuing and the infra spec seems to prefer the list term in that case
  • Define the fact that we also store the animation along with the event since we need it to establish composite order
  • While we're at it, we should also indicate how we get from event to composite order -- what if you have no keyframe effect? What if you have multiple keyframe effects?
  • We should also define how events with an undefined scheduled event time sort

(Note that animation playback events target Animation objects while CSS transition and animation events target elements so if you need a means to go from event to target element(s), we'd need more spec text for that.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants