[csswg-drafts] [css-view-transitions-2] Support same-site cross-origin view transitions (#10364)

khushalsagar has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-view-transitions-2] Support same-site cross-origin view transitions ==
The cross-document [spec](https://drafts.csswg.org/css-view-transitions-2/) currently limits transitions to Document in the same-origin. This misses a common use-case of transitions on same-site cross-origin navigations: a.example.com -> b.example.com.

Since there is a security boundary between each origin, and transitions require sending the [captured element](https://drafts.csswg.org/css-view-transitions-1/#captured-elements) data from the old Document to the new Document, this can't be done by default. But it should be feasible if both Documents opt-in to transitions from each other.

The above can likely be added to the `@view-transition` rule using 2 descriptors: `from`/`to`. Where the descriptor provides the URLs for Documents which it permits transitions from or to. The default value (`auto`?) would limit to only same-origin URLs. Something like on a.example.com:

```css
/* Applies to all same-origin navigations */
@view-transition {
  navigation: auto;
}

@view-transition {
  navigation: auto;
  from: url-pattern("https://b.example.com/*");
}
```

The idea of `from`/`to` was discussed on https://github.com/w3c/csswg-drafts/issues/8925 and this is a good use-case which needs it.

We can also add a keyword like `same-site` to opt-in to transitions from/to any same-site URL.

@vmpstr @noamr @bramus @jakearchibald @nt1m

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10364 using your GitHub account


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

Received on Thursday, 23 May 2024 20:03:24 UTC