-
Notifications
You must be signed in to change notification settings - Fork 711
[css-view-transitions-1] Multiple elements with same view-transition-name #8890
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
Comments
The transition is aborted. Its step 8.3.1.6.5 here : "If usedTransitionNames contains transitionName, then return failure." Same thing happens when we look for transition names in the new DOM. The name has to match exactly 2 elements from the old and new DOM so it must be unique or the author made an error. |
It is worth noting that web developers have a need for the opposite (which can be solved by preprocessors, but some would like to do it natively on the platform). |
Thanks for that link! You hit a very good con of the approach to tag every item in a list with a view-transition-name here: "I imagine this is fairly moot, but could also be similar to a “too many DOM nodes” performance and debugging issue." There is a significant rendering overhead to adding The optimal way to do this is to add the name only to the list item the user clicked. This is trivial to do with script (using a Coming back to this topic, the fundamental issue is that the browser needs |
Without solving the performance problem, is it workable to put the calculation of the correct elements on the UA, leaving one of the pair as the root or unique element? This will make it possible to trigger a transition to an article and then back to the list item, but not from an article to a list item without a previous transition. ui-el {
view-transition: --name / auto; /* root */
view-transition: --name / element(#top);
view-transition: --name; /* default */
view-transition-target: normal} /* same */
::view-transition-from-nth(--name) {…}
::view-transition-to-nth(--name) {…}
::view-transition-to-target(--name) {…}
::view-transition-from-target(--name) {…} <meta name = view-transition-name content = --name>
<!-- => -1--name | -2--name --> <ui-el>-1--name</ui-el>
<ui-el>-2--name</ui-el> |
@rthrejheytjyrtj545 do you mind clarifying the proposal? I didn't follow what I'm dubious that we'd go for any solution which doesn't solve the performance problem for the list <-> details case. But I still want to understand this proposal, in case it makes sense for a different use-case we've seen. |
My proposal specifies two entities: any number of elements on one page and one element on another. In the meantime, the UA pretends that the elements are additionally numbered, so that it can remember from the interaction with which element from the set the transition occurred (it can track this with some heuristic or a new type of container), and how to pass this number to the ending element. So, for example, if the transition came from the third element, in today's paradigm it would be the same as if both elements had a |
Sorry about the late reply and thanks for the clarification.
It sounds like you want the UA to tie an interaction (like a click event) to an element and the transition to the interaction. This would basically allow conditionally adding a view-transition-name to one of the elements in the list, if that's the one the user interacted with. #8209 seems like a nicer way to do that, since it basically allows you to set any CSS (including view-transition-name). I noticed you +1'd the last comment there (thanks for taking the time to review the proposal). Given that, I'll close this issue but please feel free to re-open. |
What happens when multiple elements have the same view-transition-name value?
The text was updated successfully, but these errors were encountered: