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

> Re: media query and importantly having the ability to add general css in those blocks (to add/remove `view-transition-name` on elements), does it make sense to have a `@navigation` (instead of `@media`) for this to gate based on navigation type
> 
> Eg,
> 
> ```css
> .foo {
>  view-transition-name: foo
> }
> @navigation reload {
> .foo {
>   view-transition-name: none
> }
> }
> ```
> 
> Or something along those lines? Or is the objection to the media-query style proposal extend to any at-rule style syntax?
> 
> Also, presumably `@view-transition` opt-in block can also be wrapped in the `@navigation` block

Think of two things:
1. composition
2. compatibility with SPA
```css
@view-transition :reload {
  navigation-trigger: cross-document;
  view-transition-group: refreshing;
}

@media (view-transition-group: refreshing) and (prefers-reduce-motion: no-preference) {
}
```

```js
function refreshView() {
  startViewTransition({ groupName: "refreshing", update: async () => { ... });
}
```

Also having it as an MQ gives us the MQ javascript API for free.
I don't see what a new @ rule adds when it acts exactly like a media query.

-- 
GitHub Notification of comment by noamr
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/8048#issuecomment-1671771082 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 16:38:17 UTC