-
Notifications
You must be signed in to change notification settings - Fork 669
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
[css-view-transitions-1] Fragmented elements don't participate in view transitions. #8831
Conversation
css-view-transitions-1/Overview.bs
Outdated
@@ -1243,19 +1243,17 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface; | |||
|
|||
1. If any [=flat tree=] ancestor of this |element| [=skips its contents=], then [=continue=]. | |||
|
|||
1. If |element| is not |element|'s [=tree/root=] and |element| allows [=fragmentation=], then [=continue=]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need this in Handle transition frame as well. Iterate through all the elements and check if any of them is fragmented. If so, skip.
The idea being that we ignored fragmented elements when looking for elements with a view-transition-name. But if an element became fragmented during the animation, we skip the transition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't see any of this in the resolution. The resolution was that fragmented elements are ignored, not that they cancel the transition. Am I missing a conversation? Do we need to deal with this at all after elements were captured?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was part of option 1 which we were asking the group to resolve on:
"When constraints are broken, transitions skip to the end (#7882).
Sub-option: Is the constraint broken if an element fragments, or if an element can fragment?"
We have a similar pattern with elements having a box. Safely ignore an element which has a view-transition-name but doesn't generate a box: https://drafts.csswg.org/css-view-transitions-1/#capture-old-state-algorithm:~:text=for%20element.-,If%20transitionName%20is%20none%2C%20or%20element%20is%20not%20rendered%2C%20then%20continue.,-If%20any%20of
But because elements in the new DOM are live, this state can change for them while the transition is running. We treat them as developer errors and abort the transition: https://drafts.csswg.org/css-view-transitions-1/#update-pseudo-element-styles:~:text=If%20any%20flat%20tree%20ancestor%20of%20capturedElement%E2%80%99s%20new%20element%20skips%20its%20contents%2C%20or%20capturedElement%E2%80%99s%20new%20element%20is%20not%20rendered%2C%20then%20return%20failure.
So the logic is that if a DOM element was not fragmented when the transition started but becomes fragmented during the animation, then the safest way to handle it is to abort the transition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Co-authored-by: Khushal Sagar <63884798+khushalsagar@users.noreply.github.com>
css-view-transitions-1/Overview.bs
Outdated
@@ -1614,8 +1612,11 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface; | |||
|
|||
1. Let |hasActiveAnimations| be a boolean, initially false. | |||
|
|||
1. [=list/For each=] |element| of |transition|'s [=ViewTransition/transition root pseudo-element=]'s [=tree/inclusive descendants=]: | |||
1. [=map/For each=] |transitionName| → |capturedElement| of |transition|'s [=ViewTransition/named elements=], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the confusion but now that dug through the spec to answer your question, step 8.8.3.1 here seems like a better spot for this. We already check all the other per element constraints which abort the transition here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Skip fragmented elements when preparing transition, and add note about looking at this again in the future.
See resolution.
Closes #8339