Re: [csswg-drafts] [css-view-transitions-1] Allow to control whether make a particular group when the named element was there only in one side (#8528)

> would authors need this nesting to be conditional based on whether a view-transition-name has both old/new images or only one of them

That would be the only way to fulfill this use-case as far as I can tell. If the developer knows in advance whether to request nesting or not, they could also just not apply `view-transition-name`.

I see two ways to add this feature:

```
view-transition-nesting: if-old-only;
```

This means the group will be nested if there's only an old state. I guess you could have other values, like `if-new-only` and `if-single-image` (which is like `if-new-only` _or_ `if-old-only`).

Alternatively:

```js
const viewTransition = document.startViewTransition(updateCallback);
const transitionDetails = await transition.ready;

if (transitionDetails.groups.foo && !transitionDetails.groups.foo.new) {
  transitionDetails.groups.root.append(transitionDetails.groups.foo);
}
```

…which is an imperative API that lets you trigger the nesting of groups.

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


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

Received on Wednesday, 8 March 2023 09:14:38 UTC