Skip to content

[css-view-transitions-1] What should we do if someone skips the view transition when flushing the previous update callbacks #11943

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

Open
BorisChiou opened this issue Mar 14, 2025 · 8 comments · May be fixed by #11947
Labels
css-view-transitions-1 View Transitions; Bugs only

Comments

@BorisChiou
Copy link
Contributor

This is more like a question because I don't have a testcase for this.

Per the recent update of the spec in 7.3. Setup view transition:

To setup view transition for a ViewTransition transition, perform the following steps:

  1. Let document be transition’s relevant global object’s associated document.
  2. Flush the update callback queue.
  3. Capture the old state for transition.

The step 2, "flush the update callback queue" runs the scripts, so I'm thinking is it possible that script skips the current view transition we are setting up? It's impossible to call skipTransition() API in the previous update callbacks to skip the new view transition, so all I can think of is to change the visibility of the document. However, the change of visibility of the document queues a DOM task so it may happen after we setup the current view transition. However, I'm not sure if there are any other ways to skip the view transitions. (But it sounds like possible?)

So is it possible that someone skips the current view transition in previous update callbacks when we setup the current view transition? If it is possible, what is the expected behavior here?

cc @noamr and @emilio

@BorisChiou BorisChiou added the css-view-transitions-1 View Transitions; Bugs only label Mar 14, 2025
@noamr
Copy link
Collaborator

noamr commented Mar 15, 2025

I'm a bit confused about the problem here. Can you elaborate on the scenario? I don't see an inherent problem with the script that runs as part of a DOM update skipping a newer transition, and this was possible before.

@BorisChiou
Copy link
Contributor Author

Can you elaborate on the scenario?

Sorry, this is more like a question because I was trying to make sure we don't have to worry about the case if any script skips the current view transition we are setting up. This means in the step 2:

  1. Let document be transition’s relevant global object’s associated document.
  2. Flush the update callback queue.

I want to make sure the "Flush the update callback queue" never skips the current view transition.

I don't see an inherent problem with the script that runs as part of a DOM update skipping a newer transition, and this was possible before.

Yes, this is my question. Just wonder if it is possible after your update.

Thanks for the feedback.

Close this issue because we don't have to worry about this case.

@emilio
Copy link
Collaborator

emilio commented Mar 15, 2025

The issue is the acrop

@emilio emilio reopened this Mar 15, 2025
@emilio
Copy link
Collaborator

emilio commented Mar 15, 2025

Err... The issue is the script skipping the transition you're just about to do the capture for

@emilio
Copy link
Collaborator

emilio commented Mar 15, 2025

It seems at the very least we should check the transition state again after flushing the queue right?

@noamr
Copy link
Collaborator

noamr commented Mar 16, 2025

It seems at the very least we should check the transition state again after flushing the queue right?

Ah I see
Sure

@noamr
Copy link
Collaborator

noamr commented Mar 16, 2025

Perhaps the call to "flush the update callback queue" should move to the beginning of https://drafts.csswg.org/css-view-transitions-1/#perform-pending-transition-operations-algorithm

@emilio
Copy link
Collaborator

emilio commented Mar 16, 2025

Yes, I think that'd be a sensible thing.

noamr added a commit to noamr/csswg-drafts that referenced this issue Mar 16, 2025
…ther view-transition operations

This ensures that a DOM update callback that skips the active
transition would take effect.

Closes w3c#11943
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
css-view-transitions-1 View Transitions; Bugs only
Projects
None yet
3 participants