Re: [csswg-drafts] [css-view-transitions-2] Creating 'classes' of transition groups (#8319)

> in order for it to work reliably in frameworks, you need to assign a key to elements so the diffing algorithm has a fighting chance of getting it right. And, if you're having to assign a key, you may as well assign a `view-transition-name`.

Rewinding a little bit back: I’m OK with having `view-transition-group` _by itself_ work on only SPA.

When it is set:
- The `view-transition-name` would be defined automagically
- The value of the `view-transition-group` would be targetable within the pseudos. This would mean that the value must be unique among `view-transition-group` and `view-transition-name`.
 
```css
::view-transition-new(card) {
  …
}

.card {
  view-transition-group: card;
}
```

To make this work with MPA, I think the solution lies in https://github.com/w3c/csswg-drafts/issues/9141 _(dynamically construct `<ident>`s)_ combined with `attr()`.

```
::view-transition-new(card) {
  …
}

.card {
  view-transition-group: card;
  view-transition-name: ident("card-", attr(id));
}
```

This way, across pages, the same `view-transition-name` can be given to the correct elements, without needing to duplicate a bunch of CSS. In SPA it can also be used, but is not mandatory, due to the automatic `view-transition-name` generation I mentioned earlier.

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


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

Received on Thursday, 5 October 2023 12:11:22 UTC