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

The CSS Working Group just discussed `[css-view-transitions-2] Declarative opt-in for cross-document navigations`, and agreed to the following:

* `RESOLVED: Use an at-rule (of some kind) to control cross-document VT transitions, syntax tbd`

<details><summary>The full IRC log of that discussion</summary>
&lt;TabAtkins> noamr: VT2 adds cross-document transitions<br>
&lt;TabAtkins> noamr: This involves two added capabilities to same-doc transitions<br>
&lt;TabAtkins> noamr: One is the declarative opt-in, which is this issue<br>
&lt;TabAtkins> noamr: So instead of starting the transitio using JS, both transitions need to have an opt-in in CSS<br>
&lt;emilio> q+<br>
&lt;TabAtkins> noamr: If both documents approve, the transition happens, as if we'd called a startViewTransition()<br>
&lt;noamr> https://drafts.csswg.org/css-view-transitions-2/<br>
&lt;khush> q+<br>
&lt;noamr> https://github.com/w3c/csswg-drafts/issues/8048#issuecomment-1637806513<br>
&lt;TabAtkins> noamr: here's the spec, and heres the issue comment<br>
&lt;TabAtkins> noamr: So the current idea is to have a new at-rule, currnetly called @auto-view-transition<br>
&lt;TabAtkins> noamr: At first we'd have only one property in it, which is 'same-origin: enable | disable'<br>
&lt;TabAtkins> noamr: while we have only one value to do right now, we expect to need to extend this in the future so we're going with a declaration design<br>
&lt;TabAtkins> noamr: Welcome bikeshedding<br>
&lt;TabAtkins> noamr: In the future we want to be able to nest this inside of MQ/conditionals<br>
&lt;TabAtkins> noamr: So you can, for example, guard it by (prefers-reduced-motion)<br>
&lt;TabAtkins> noamr: also might want an opt-in to disable same-document view transitions<br>
&lt;TabAtkins> noamr: At the moment I think we could probably only want to ahve this affect automatic VTs, let JS deal with the rest<br>
&lt;TabAtkins> emilio: This is the kind of thing we've generally fixed via meta tags, like color-scheme, viewport, etc<br>
&lt;TabAtkins> emilio: it seems liek the mai point of putting this in CSS is to use MQs, but &lt;meta media> exists<br>
&lt;TabAtkins> emilio: Has that been considered and discarded? If so, why?<br>
&lt;TabAtkins> noamr: It has been.<br>
&lt;TabAtkins> noamr: the original proposal was meta tags<br>
&lt;TabAtkins> noamr: it's mainly around keeping the styling all in css<br>
&lt;TabAtkins> q+<br>
&lt;TabAtkins> q++<br>
&lt;TabAtkins> qq+<br>
&lt;TabAtkins> ack +<br>
&lt;fantasai> TabAtkins: Part of the reason why it's not quite as necessary in meta<br>
&lt;bramus> q+<br>
&lt;astearns> ack TabAtkins<br>
&lt;Zakim> TabAtkins, you wanted to react to fantasai<br>
&lt;fantasai> TabAtkins: we do that for other things so you have it as early in loading as possible<br>
&lt;fantasai> TabAtkins: given you need enough styling to render the page, delaying the permission for cross-document transition doesn't hurt you at all<br>
&lt;fantasai> TabAtkins: you don't need to be early<br>
&lt;fantasai> TabAtkins: you might have to hold onto the first page a little longer<br>
&lt;fantasai> TabAtkins: but waiting until all style comes in to turn on is fine, because you need all that style to render to create a VT anyway<br>
&lt;TabAtkins> SebastianZ: having such an at-rule would also mean having it high in the stylesheet<br>
&lt;emilio> q+<br>
&lt;fantasai> SebastianZ: it would need to be near the top near @import, right<br>
&lt;fantasai> TabAtkins: you have to read the whole stylesheet to render the VT anyway, so doesn't matter where you put it<br>
&lt;fantasai> astearns: [missed something]<br>
&lt;TabAtkins> khush: from impl perspective, right now we want to avoid having to parse stuff in the new page before capturing new<br>
&lt;TabAtkins> khush: right now, since both are fro mthe same site, if the start page opts in it's likely the end page will also opt in so we eagerly capture the start page's elements<br>
&lt;TabAtkins> khush: there's also some concept in HTML about render-blocking stylesheets, hopefully we can get authors to get the rule in those stylesheets<br>
&lt;astearns> s/[missed something]/if the first page opts in, then we are spending time reading CSS for the second page even if it is opt-out<br>
&lt;TabAtkins> khush: We might be holding onto the start page a little longer, but the chance of discarding is pretty low. We think it's worth going for what's most ergonomic for webdevs<br>
&lt;astearns> q?<br>
&lt;TabAtkins> emilio: Do we want to make this work eventually for cross-origin?<br>
&lt;TabAtkins> emilio: If both pages opt in, it seems like it could work... (barring security constraints)<br>
&lt;TabAtkins> ack TabAtkins<br>
&lt;TabAtkins> khush: We have some use-cases right now for same-site, but not strong ones for cross-site<br>
&lt;TabAtkins> khush: and similarly in same-site it's likely both will opt in<br>
&lt;TabAtkins> vmpstr: And still, doing a little bit of extra work that's potentially wasted, it doesn't really affect how much of the end page you have to parse before you know.<br>
&lt;TabAtkins> vmpstr: Even if it was in meta tags we'd still have to eagerly capture the old page<br>
&lt;TabAtkins> emilio: so you have to wait for things to load and you have to delay rendering the new page until things are loaded<br>
&lt;TabAtkins> emilio: So if you define it's a meta tag that's read, you can start rendering the new page earlier, as we do now<br>
&lt;vmpstr> q?<br>
&lt;TabAtkins> khush: We're not trying to delay rendering just because there's a transition. there's already render-blocking in html<br>
&lt;TabAtkins> khush: We have to fetch enough of the dom and stylesheets before first render anyway<br>
&lt;TabAtkins> khush: So there will be some amoutn of CSS we have to block first frame on anyway<br>
&lt;TabAtkins> khush: They can put these rules into the same stylesheets and not delay rendering further than what it needs to<br>
&lt;TabAtkins> emilio: If you only have one dev that knows how to do this, sure, but that's not true generally<br>
&lt;TabAtkins> khush: the author has to think about it anyway<br>
&lt;TabAtkins> khush: So much CSS has to be parsed before you do first render anyway to make the animation work<br>
&lt;TabAtkins> emilio: VT doesn't wait, then? It does first render asap and relies on render blocking?<br>
&lt;TabAtkins> emilio: My understanding was we have to wait for the page to be fully loaded<br>
&lt;TabAtkins> khush: Right. In same-document you get a callback so you can block until ready.<br>
&lt;TabAtkins> khush: In cross-document we're relying on render blocking for the same<br>
&lt;TabAtkins> emilio: So if the stylesheets in the head are loaded we can start rendering before content is loaded<br>
&lt;TabAtkins> khush: there's an html issue where render blocking today is just stylesheets, but we are proposing extending it to content too<br>
&lt;TabAtkins> khush: So you can detail which elements need to exist before render starts. and a timeout does some fallback<br>
&lt;TabAtkins> emilio: So an important part of why specifying it in css is fine or not.[ not sure what this sentence meant]<br>
&lt;TabAtkins> emilio: with meta the order is clear<br>
&lt;TabAtkins> emilio: with an at-rule, then we need to define how they cascade<br>
&lt;TabAtkins> khush: I think that problem needs to be solved anyway.<br>
&lt;TabAtkins> khush: We have a feature request to have it apply only for some navigations - between certain urls, only on reloads, etc<br>
&lt;TabAtkins> khush: So author will need settings for these kinds of things<br>
&lt;TabAtkins> emilio: so if you ahve that, how they interact needs to be defined<br>
&lt;TabAtkins> noamr: we'll be using the same ordering that other at-rules use, stylesheet order<br>
&lt;TabAtkins> emilio: layers too<br>
&lt;TabAtkins> noamr: right, including all of that<br>
&lt;TabAtkins> (they'll cascade atomically, like most at-rules)<br>
&lt;astearns> q?<br>
&lt;astearns> ack khush<br>
&lt;TabAtkins> khush: just to give a concrete example<br>
&lt;SebastianZ> q+<br>
&lt;TabAtkins> khush: for same-site, going from foo.bar.com to baz.bar.com, you can say "im okay with most transitions, but veto this one url"<br>
&lt;TabAtkins> khush: so you'll specify two of these rules, one generally and one specialized to that path<br>
&lt;astearns> ack bramus<br>
&lt;TabAtkins> khush: so we'll need to make sure authors can specify a default behavior but override in special cases<br>
&lt;TabAtkins> bramus: i'm very in favor of doing this in CSS<br>
&lt;TabAtkins> bramus: was wondering about the name - auto-view-transition<br>
&lt;TabAtkins> bramus: Could it be more generic? @config? to cater to more descriptors in the future beyond VT<br>
&lt;TabAtkins> bramus: Also curious how this interacts with the cascade<br>
&lt;hober> qq+<br>
&lt;TabAtkins> bramus: Think I saw Tab saying no<br>
&lt;TabAtkins> (correct)<br>
&lt;TabAtkins> hober: I think it would be a mistake to rename to generic.<br>
&lt;TabAtkins> hober: We don't have use-cases for non-VT cases right now. Having a generic name would be an attractive nuisance, I'd prefer it be purpose-built<br>
&lt;khush> +1 to keep it VT specific. We can make the pattern generic if needed.<br>
&lt;astearns> ack emilio<br>
&lt;astearns> ack hober<br>
&lt;Zakim> hober, you wanted to react to bramus<br>
&lt;TabAtkins> (agree strongly, plus it does have some VT-specific things it needs in filtering/etc)<br>
&lt;emilio> +1, at-rules like this are relatively inexpensive<br>
&lt;TabAtkins> fantasai: strongly agree to keep it in CSS, using meta is awful. styling should be in css if at all possible, external stylesheets are great<br>
&lt;emilio> s/+1/+1 to hober's comment/<br>
&lt;TabAtkins> fantasai: With multiple of these rules, you probably want them to cascade together? if the last rule says you want to disable cross-origin transitions, you don't want it to break the rest of the settings.<br>
&lt;TabAtkins> fantasai: so we might want it to cascade individual descriptors, which some at-rules do<br>
&lt;bramus> +1 to that<br>
&lt;TabAtkins> (currently, only the ones that apply things to element-like stuff, i think?<br>
&lt;TabAtkins> )<br>
&lt;TabAtkins> fantasai: can you say same-origin:disable;cross-origin:enable? that's weird. would be good to explore the full space of likely descriptors first to make sure they're coherent together<br>
&lt;TabAtkins> fantasai: think there was some discussion about different classes of transitions dpeneding on page you're going to/from<br>
&lt;TabAtkins> fantasai: Might not be the first thing we do, but should be explored to make sure the shape of the at-rule is good.<br>
&lt;TabAtkins> fantasai: So overall I agree with the direction of this, using an at-rule rather than meta unless ther'es a good mechanical reason.<br>
&lt;astearns> q+<br>
&lt;astearns> ack fantasai<br>
&lt;TabAtkins> fantasai: but i think before we can udnerstand if the syntax is good we need to explore the spaces we're expecting to extend into first<br>
&lt;noamr> q+<br>
&lt;TabAtkins> SebastianZ: an idea from Bramus was to put the detection into a media feature<br>
&lt;astearns> ack SebastianZ<br>
&lt;bramus> Link: https://github.com/w3c/csswg-drafts/issues/8048#issuecomment-1551535268<br>
&lt;bramus> (second bullet)<br>
&lt;TabAtkins> SebastianZ: with that we could put everything that needs to be transitioned into that rule<br>
&lt;SebastianZ> https://github.com/w3c/csswg-drafts/issues/8048#issuecomment-1551535268<br>
&lt;fantasai> astearns: He's proposing to put into the @media rule<br>
&lt;TabAtkins> bramus: I immediatley discarded tha tidea in the next comment, it doesn't allow setting the choice<br>
&lt;TabAtkins> bramus: An MQ could complement the setting<br>
&lt;fantasai> emilio: wouldn't that create cycles<br>
&lt;khush> q+<br>
&lt;federicobucchi> presence+<br>
&lt;fantasai> TabAtkins: make it possible to change styling when VT is enabled<br>
&lt;fantasai> s/enabled/happening/<br>
&lt;fantasai> TabAtkins: you might want different styles for the page in that case<br>
&lt;TabAtkins> astearns: I'm not convinced yet that we won't need the meta tag<br>
&lt;TabAtkins> astearns: But I think we could start with the at-rule and if we find there is a perf reason to ahve the meta as the opt-in, we can add later<br>
&lt;khush> https://github.com/w3c/csswg-drafts/issues/8925 is related to media queries for setting state based on where you're navigating to.<br>
&lt;TabAtkins> astearns: the at-rule would still be necessary for other settings besides the bare opt-in<br>
&lt;astearns> q?<br>
&lt;TabAtkins> emilio: As long as there's a concrete point in time where the at-rule needs to be seen<br>
&lt;TabAtkins> emilio: then i don't object to an at-rule<br>
&lt;astearns> ack astearns<br>
&lt;TabAtkins> emilio: I just don't want to introduce unnecessary style updates to look up this config<br>
&lt;astearns> ack noamr<br>
&lt;TabAtkins> noamr: in reverse order<br>
&lt;TabAtkins> noamr: We're not adding new style updates, just parsing the stylesheet to capture the rules. no need for a full cascade<br>
&lt;emilio> q+<br>
&lt;TabAtkins> noamr: For MQs, that's a spearate feature, possibly an enhancement for later<br>
&lt;TabAtkins> noamr: wrt fantasai wanting more examples for th efuture, i think that's a fair request<br>
&lt;TabAtkins> noamr: something thats already come up is the ability to use this opt-in to disable same-document VTs.<br>
&lt;TabAtkins> noamr: So you can disable all VTs under prefers-reduced-motion<br>
&lt;TabAtkins> noamr: so that's one use-case we've already seen<br>
&lt;TabAtkins> noamr: Another was same-site or first-party-set<br>
&lt;TabAtkins> noamr: Another was having declarative same-document transitions, like allowing Navigation API to trigger VTs.<br>
&lt;astearns> ack khush<br>
&lt;TabAtkins> khush: one thing emilio brought up was having a defined point where this is queried<br>
&lt;TabAtkins> khush: we have to have a defined point where browser captures everything anyway<br>
&lt;TabAtkins> khush: so our thinking was to use the same point as when you set up styles and states for the navigation, shoudl b ethe same point we set the opt-in<br>
&lt;TabAtkins> khush: I also pasted 8925 which is related to this<br>
&lt;TabAtkins> khush: there's an idea of adding MQs to allow setting state based on old and new url<br>
&lt;TabAtkins> khush: this opt-in might play with that<br>
&lt;TabAtkins> khush: so you can use that MQ to set this at-rule to disable certain paths<br>
&lt;astearns> ack emilio<br>
&lt;TabAtkins> khush: so we can come back with more information on this<br>
&lt;TabAtkins> emilio: re noam's comment, you don't need to update dom styles but you still need to go thru all the stylesheets and make sure it's sorted correctly<br>
&lt;TabAtkins> emilio: adding a fast path for this doesn't seem appealing to me<br>
&lt;TabAtkins> emilio: in blink/wk terminology, this needs to "update the active stylesheets" and that still shows up considerably during page load<br>
&lt;TabAtkins> emilio: and i don't want to do that until all stylesheets are loaded<br>
&lt;TabAtkins> emilio: i'd rather make sure that on the page you're navigating to you don't need to do unnecessary work to hook this up<br>
&lt;vmpstr> q+<br>
&lt;TabAtkins> emilio: so ideally the point where you determine the VT doesn't involve synchronously updating the active stylesheets<br>
&lt;astearns> ack vmpstr<br>
&lt;TabAtkins> vmpstr: I think the way were' structuring this is we're using othe rproperties, such as render blocking and proposed additions to that, to control when the document will render<br>
&lt;TabAtkins> vmpstr: and defining VT to say "at the point when the doc will render, you have know the opt-in/out'<br>
&lt;TabAtkins> vmpstr: So no extra work, but giving the dev a litlte more control over first render timing<br>
&lt;TabAtkins> vmpstr: And on the meta tag, we've discussed a double opt-in - a simple meta that can indicate whether the VT is even possible, and then use the at-rule for all the actual options<br>
&lt;TabAtkins> vmpstr: I'm not opposed to that, but think we still want the css at-rule for more detailed config<br>
&lt;TabAtkins> emilio: Using the initial frame for this makes sense and satisfies my constraint<br>
&lt;TabAtkins> khush: Okay then the spec currently says that's when we should be chekcing the opt-in<br>
&lt;TabAtkins> astearns: For this issue can we have a resolution to use the at-rule initially?<br>
&lt;TabAtkins> emilio: seems fine<br>
&lt;TabAtkins> noamr: also to start with an at-rule, but bring more examples of future usage to determine exact syntax<br>
&lt;TabAtkins> fantasai: yeah we can resolve *an* at-rule, not necessarily this exact shape<br>
&lt;TabAtkins> astearns: so proposed resolution is to use an at-rule for cross-document VT transitions<br>
&lt;TabAtkins>  noamr: and gather examplkes before we decide on final syntax<br>
&lt;TabAtkins> RESOLVED: Use an at-rule (of some kind) to control cross-document VT transitions, syntax tbd<br>
&lt;TabAtkins> fantasai: Note it's not just examples of what's already there, it's looking at what might be possible<br>
</details>


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


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

Received on Tuesday, 18 July 2023 16:45:25 UTC