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

[css-view-transitions-2] Clarify a few nesting details #10964

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

noamr
Copy link
Collaborator

@noamr noamr commented Sep 27, 2024

  • view-transition-group maintains the tree-scoping relationship
  • nearest/custom-ident act like contain for their descendants

Closes #10780
Closes #10633

See resolutions in the above issues.

@@ -820,20 +820,20 @@ and by applying ''view-transition-group'' to the internal element referencing th

When the [=computed value=] of 'view-transition-name' for an element is ''view-transition-name/none'', its 'view-transition-group' [=used value=] is always resolved to ''view-transition-name/none'' as well.

The <dfn>relevant tree</dfn> for the 'view-transition-group' property is the [=tree=] that includes the element in which the property itself is declared.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is trying to capture the tree scope for the computed value right? Would it be enough to say that the used value for group is "normal" if it doesn't match view transition name's scope. Because the group only applies if the name does and we have checks to only apply the name if the tree scope matches the transition's tree scope.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


1. Let |nearestAncestorWithContain| be |element|'s nearest ancestor whose 'view-transition-name' [=computed value=] is not ''view-transition-name/none'' and whose 'view-transition-group' [=computed value=] is ''view-transition-group/contain''.
1. Let |nearestAncestorWithContain| be |element|'s nearest [=tree/ancestor=] in |tree|, whose 'view-transition-name' [=computed value=] is not ''view-transition-name/none'' and whose 'view-transition-group' [=computed value=] is not ''view-transition-group/normal''.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need to pass tree here? We can ignore the group if its computed value's tree scope doesn't match view-transition-name's tree scope.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@khushalsagar
Copy link
Member

Eh, it looks like you missed publishing new changes. :)

@noamr
Copy link
Collaborator Author

noamr commented Oct 2, 2024

Eh, it looks like you missed publishing new changes. :)

Oops, look now

- view-transition-group is tree-scoped
- nearest/custom-ident act like contain

Closes w3c#10780
Closes w3c#10633
Note: An element with ''view-transition-group/contain'' becomes the [=nearest containing group name=] for its [=tree/descendants=].

: <dfn>nearest</dfn>
:: The [=used value=] is the 'view-transition-name' [=computed value=] of the nearest [=tree/ancestor=] whose 'view-transition-name' [=computed value=] is not ''view-transition-name/none''.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we use the computed or used value of the name? With auto based naming seems like it should be used.


: <dfn><<custom-ident>></dfn>
:: The [=used value=] is the given <<custom-ident>> if the element has an ancestor whose 'view-transition-name' [=computed value=] is that <<custom-ident>>, otherwise the element's [=nearest containing group name=]
:: The [=used value=] is the given <<custom-ident>> if the element has an [=tree/ancestor=] whose 'view-transition-name' [=computed value=] is that <<custom-ident>>, otherwise the element's [=nearest containing group name=].
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question, not sure if we need the used or computed value of v-t-name.

@@ -888,20 +888,20 @@ and by applying ''view-transition-group'' to the internal element referencing th

<dl dfn-type=value dfn-for=view-transition-group>
: <dfn>normal</dfn>
:: The [=used value=] is the element's [=nearest containing group name=].
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have no spec text for "normal" now. Is that intentional..?

</dl>

When the ''view-transition-group'' and ''view-transition-name'' properties are declared in a different [=tree=], ''view-transition-group'' resolves to the [=nearest containing group name=].
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reading this line out loud, if the tree scope for the group and name on an element is different then group "resolves" to the nearest containing group name. resolves here means used value? So basically if a named element participates in a transition in the outer scope but group was set in the inner scope, then the used group is the nearest containing group. This is the same as if the group is set to normal.

Worth a note since it's subtle, just to say this: "This means that if the group's computed value has a different tree scope than the name, the group's value is treated the same as normal".

@@ -1182,7 +1182,7 @@ When capturing the old or new state for an element, perform the following steps

To get the <dfn>nearest containing group name</dfn> for an {{Element}} |element|, perform the following steps:

1. Let |nearestAncestorWithContain| be |element|'s nearest ancestor whose 'view-transition-name' [=computed value=] is not ''view-transition-name/none'' and whose 'view-transition-group' [=computed value=] is ''view-transition-group/contain''.
1. Let |nearestAncestorWithContain| be |element|'s nearest [=tree/ancestor=] whose 'view-transition-name' [=computed value=] is not ''view-transition-name/none'' and whose 'view-transition-group' [=computed value=] is not ''view-transition-group/normal''.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just confirming that there's no edge case here. There are cases where we ignore element's with a name here: https://drafts.csswg.org/css-view-transitions-1/#capture-the-old-state. It's in step 8 for elements without a box or if it's c-v: hidden/auto. In all such cases the element's descendants will also be ignored so it doesn't really matter.

If that sounds good, maybe leave a note.

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