Re: [csswg-drafts] [css-view-transitions-2] Allow an auto-generated `view-transition-name` that doesn't default to ID (#10995)

> @jakearchibald I don't think single-page use cases and multi-page use cases are the same. Your assumption is that they are the same, but I don't see that be the case in the future.
> 
> Here are some single-page use cases of view transitions:
> 
> https://codepen.io/smashingmag/full/BabaBKz https://codepen.io/argyleink/pen/dyLNgpX https://codepen.io/argyleink/pen/ZEmLrze

`match-element` should work great here. The automatic ID matching doesn't add anything to any of these.

> 
> Here are multi-page use cases:
> 
> https://astro-records.pages.dev https://spotify-astro-transitions.vercel.app

What makes these "multi-page" in the cross-document sense? Astro supports both cross-document and same-document mode. Right now auto name generation would not work with either the `auto` and `match-element` proposal without changing the DOM and adding IDs everywhere (neither astro examples use IDs in conjunction with `view-transition-name`)... 

If I was building an app like this and wanted auto name generation, I'd probably wait until `attr` is around and use `view-transition-name` until then.

> The `auto` keyword allows the CSS author to identify a set of elements using selectors (such as class selectors), and to indicate that they should use view transitions to visually transition from one DOM state to another, and let's the JS author figure out how they want to manage the tree and the elements' sense of identity. This is imho a perfectly reasonable way to divide the responsibilities. It is not going to be reasonable for some use cases, but it is going to be very convenient for others. And that's OK.

`auto` also implies that this is some sort of standard/common/best-practice way to use the API. I find that using IDs in today's web is not a common practice, and CSS shouldn't be the place to be opinionated about it. As evidence, in the 5 examples brought here only one uses IDs on elements with `view-transition-name`. 

Perhaps having this behavior under a different name would feel a bit more reasonable? `auto-match`?

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


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

Received on Wednesday, 6 November 2024 09:41:03 UTC