Re: [csswg-drafts] [css-view-transitions-2] Declarative opt-in for cross-document navigations (#8048)

> > > New media features lend themselves to target this use case. Though if we go that route, I'd suggest to keep them general and only bind them to navigation, not view transitions specifically.
> > 
> > 
> > Huge +1 to this. Navigation related media feature shouldn't be limited to view transitions. They are a general concept which VT need as a building block since we need to enable authors to use different CSS based on the ongoing navigation.
> 
> How would you use navigation media queries outside of VT? And considering that grouping would also be done with VT, this would create a strange situation where you have to compute media queries twice.

My reason was that media features refer to some [specific feature of the user agent, the display device or a user preference](https://drafts.csswg.org/mediaqueries/#mq-features). They generally don't refer to a some specific thing defined in CSS.

> The indirection is there to support non-navigation SPA (startViewTransition({groupName: "refreshing"}). Otherwise you'd have to bring all this jazz into startViewTransition or make it very coupled with the navigation API

The question is, what are the use cases for SPAs that aren't covered by the existing features?

E.g. reduced motion preferences can be handled like this using the API:

```js
if (!matchMedia('(prefers-reduced-motion)').matches) {
  document.startViewTransition(…);
}
```

Sebastian

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


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

Received on Wednesday, 9 August 2023 20:31:24 UTC