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

> @noamr sounds like you're suggesting using pseudo-classes instead of media queries for the "Needs customization" cases (which includes reload). Since pseudo-classes come with specificity, as opposed to media-queries, UA stylesheet can have a rule to disable reloads which can be overridden by the author. Just to put it again:
> 
> UA CSS
> 
> ```css
> @view-transitions:reload {
>   navigation-trigger: none;
> }
> ```
> 
> Author CSS
> 
> ```css
> @view-transitions {
>   navigation-trigger: cross-document-same-origin-navigation script;
> }
> ```
> 
> The UA rule will apply when there is a reload because it has higher specificity. But the same with media-queries won't work:
> 
> UA CSS
> 
> ```css
> @media (navigation: reload) {
>     @view-transitions {
>       navigation-trigger: none;
>     }
> }
> ```
> 
> Author CSS
> 
> ```css
> @view-transitions {
>   navigation-trigger: cross-document-same-origin-navigation script;
> zzz
> }

I'd probably just say `navigation-trigger: cross-document` or `trigger: cross-document-navigation`, and leave the same-origin part to URL specialization, e.g.:

```css
@view-transitions :cross-origin {
  navigation-trigger: cross-document;
}
```

> 
> I think pseudo-classes can work but IIUC they are meant to be for state which is per-element or a subset of elements. I haven't seen an example where a pseudo-class would activate for the whole Document.

The `@page` CSS rule uses pseudo-classes in this way. Was using that for inspiration.

> 
> Our primary motivation for using pseudo-classes is also specificity. Let's see if the WG thinks that's the right reason to use pseudo-classes instead of media-queries.

Great, let's see!

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