Re: [csswg-drafts] [css-view-transitions-2] Proposal for a view-transition-tree property (name tbd) (#10334)

> * `view-transition-parent` should likely be inherited, since that's the common pattern: if I'm parented to foo, I expect my children by default to be parented to foo.

I dont think this should be the case because of `view-transition-tree`

Imagine this:

```css
.card { /* All cards */
  view-transition-name: auto;
  view-transition-tree: preserve;

  .footer {
    view-transition-name: auto;

    .avatar {
      view-transition-name: auto;
    }
  }
}

#the-card { /* The one that moves to the other container */
  view-transition-name: the-card;
  view-transition-parent: container-2;
}
```

Without inheritance of `view-transition-parent`, the pseudo tree would look like this:

```
::view-transition
|__ ::view-transition-group(root)
|__ ::view-transition-group(container-wrapper)
    |__ ::view-transition-group(container-1)
    |   |__ ::view-transition-group(card1)
    |   |    |__ ::view-transition-group(footer)
    |   |       |__ ::view-transition-group(avatar)
    |   |__ ::view-transition-group(card2)
    |       |__ ::view-transition-group(footer)
    |           |__ ::view-transition-group(avatar)
    |__ ::view-transition-group(container-2)
        |__ ::view-transition-group(the-card)
            |__ ::view-transition-group(footer)
                |__ ::view-transition-group(avatar)
```

With inheritance of `view-transition-parent`, the pseudo tree would look like this:

```
::view-transition
|__ ::view-transition-group(root)
|__ ::view-transition-group(container-wrapper)
    |__ ::view-transition-group(container-1)
    |   |__ ::view-transition-group(card1)
    |   |    |__ ::view-transition-group(footer)
    |   |       |__ ::view-transition-group(avatar)
    |   |__ ::view-transition-group(card2)
    |       |__ ::view-transition-group(footer)
    |           |__ ::view-transition-group(avatar)
    |__ ::view-transition-group(container-2)
        |__ ::view-transition-group(the-card)
        |__ ::view-transition-group(footer)
        |__ ::view-transition-group(avatar)
```

The `view-transition-tree: preserve` here gets undone because of `view-transition-parent` used on `the-card`, which seems unfeasible.

You could say that `view-transition-parent` should not inherit when `view-transition-tree` is set to `preserve`, but afaik there is no precedent (or way for that matter) in CSS to make make a property conditionally inheritable. A property either does or doesn’t inherit.

-- 
GitHub Notification of comment by bramus
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10334#issuecomment-2163741673 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 12 June 2024 19:20:38 UTC