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;
}
```

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.

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.

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