Re: [csswg-drafts] [css-view-transitions-2] Support ViewTransitions for same-origin cross-document navigations (#8804)

The CSS Working Group just discussed `[css-view-transitions-2] Support ViewTransitions for same-origin cross-document navigations`.

<details><summary>The full IRC log of that discussion</summary>
&lt;vmpstr> scribenick: vmpstr<br>
&lt;vmpstr> noamr: i'm going to present and chat about view transitions<br>
&lt;vmpstr> noamr: we have a few VT issues scheduled for tomorrow. I feel like we deal with these issues like blind men and an elephant<br>
&lt;vmpstr> noamr: we're not seeing the big picture and what we're trying to do with it<br>
&lt;vmpstr> noamr: and some people might have not been here<br>
&lt;vmpstr> noamr: i want to show where we are and where we want to go, and start a syntax discuss that we can continue tomorrow, so everyone has context<br>
&lt;vmpstr> (presentation)<br>
&lt;vmpstr> noamr: i'll show what we have today, and plans for the future<br>
&lt;vmpstr> noamr: what is CSS view transitions (VT)<br>
&lt;vmpstr> noamr: it's a transition between states; before we had a transition between elements<br>
&lt;vmpstr> now we take a document capture it and morph it into a new state<br>
&lt;vmpstr> noamr: we do this by capturing an element snapshot, change the dom, capture a different set and morph by name<br>
&lt;vmpstr> noamr: this is a general idea of VT<br>
&lt;vmpstr> (demo)<br>
&lt;vmpstr> noamr: here there's switching immediate. But if we put it inside start view transition, they get immediately a cross fade<br>
&lt;vmpstr> noamr: now, this is a default and building on this we can define a whole bunch of customizations<br>
&lt;vmpstr> noamr: i wanted to show something similar to what we saw<br>
&lt;vmpstr> noamr: we have a button that switches states<br>
&lt;vmpstr> (live demo!)<br>
&lt;vmpstr> noamr: it does it immediately, if we add startViewTransition to it, and put it in the startViewTransition block, it cross fades<br>
&lt;vmpstr> noamr: this is nice, but you want to customize<br>
&lt;vmpstr> noamr: so for example, I'm giving h1s transition name of heading<br>
&lt;vmpstr> noamr: and then I can customize the animation between heading elements<br>
&lt;vmpstr> noamr: so now the animation is 1 second and has a blur<br>
&lt;vmpstr> noamr: I do all of this with pseudo elements<br>
&lt;vmpstr> noamr: the power here is that there is not just pseudo elements for the states together, but separate: one for the old state and one for the new state<br>
&lt;vmpstr> noamr: i'm defining that there is a slide but one of them is a reverse<br>
&lt;vmpstr> (this is still live demo)<br>
&lt;vmpstr> noamr: this is extremely customizable, there's something at the start and at the end, and pseudo elements to transfer between states<br>
&lt;vmpstr> noamr: this is css VT today in terms of features<br>
&lt;vmpstr> (back to preso)<br>
&lt;vmpstr> noamr: it creates a morph by creating a tree of pseudo elements with names like heading in this case<br>
&lt;vmpstr> noamr: it creates a group for the transition, and a pair of elements old and new for the states<br>
&lt;vmpstr> noamr: people are excited about this, there are a few companies using this and frameworks (missed the names)<br>
&lt;vmpstr> noamr: it's been a quite a popular request on surveys<br>
&lt;vmpstr> noamr: i want to jump from that to what we saw people do<br>
&lt;emeyer> s/missed the names/Svelte.kit, Astro/<br>
&lt;vmpstr> noamr: one thing that is very popular is a full page style, you set the page, you set the transition, you go to a different page<br>
&lt;vmpstr> noamr: you have one animating element that is root. Before the css VT you had to put both pages in the dom and use a transition group<br>
&lt;vmpstr> noamr: a11y wise it was where both states are in the DOM. Here there is no dom, it's pseudo elements and style<br>
&lt;vmpstr> noamr: this is a very common use case<br>
&lt;vmpstr> noamr: this is an even commoner use case. here is a list of songs, and you click one and expands to one song<br>
&lt;vmpstr> noamr: this is a list to details view, like shopping list to details<br>
&lt;vmpstr> noamr: this is extremely popular in demos that we have seen<br>
&lt;vmpstr> noamr: the third one is different: it's animated layout, you can put stuff in a grid or a list, give everything view transition names, and change their placement in the grid<br>
&lt;vmpstr> noamr: and this animates it<br>
&lt;vmpstr> noamr: this is less of a navigation, but something internal to the page. we see this in things like timeline where list changes order<br>
&lt;vmpstr> noamr: automatically sorting list is something we see a lot, and it's something i'm excited about<br>
&lt;vmpstr> noamr: it was not easy to do before, you had to create some ghost elements with transforms. it was not fun, depending on what fun is for you<br>
&lt;vmpstr> noamr: the constraints of css VT, where we are today, what you say looks demo-y<br>
&lt;vmpstr> noamr: it can be incorporated into a page, but it's limited to the document<br>
&lt;vmpstr> noamr: everything in the document you have, it will be selected for the document<br>
&lt;vmpstr> noamr: also the whole document freezes, maybe you want just a widget to animate, and you don't want the whole page to lose pointer events etc<br>
&lt;vmpstr> noamr: and you saw that a lot of cases are navigation cases, but if you leave the document, then you lose the transition. You don't have a CSS state today that is cross ocuent<br>
&lt;vmpstr> noamr: from this we derived what we want in the vision; we want to remove constraints<br>
&lt;vmpstr> noamr: to explain what we want to do, i want to show an ugly wireframe of a music list<br>
&lt;vmpstr> (demo slide)<br>
&lt;vmpstr> noamr: what you want on this page is three different transitions<br>
&lt;vmpstr> noamr: first you want the slide page thing, you want the nav bar where things slide on the next page<br>
&lt;vmpstr> noamr: then, if you click on a song, you want the song to expand<br>
&lt;vmpstr> noamr: the third if you drag and drop the list, you want the list to animate<br>
&lt;vmpstr> noamr: it doesn't look like an uncommon use case for a real web app<br>
&lt;vmpstr> noamr: when using VT myself, i was struggling with doing this: incroproate a bunch of things into the same app<br>
&lt;vmpstr> noamr: this is not in priority order, but this is what we envision for VT<br>
&lt;vmpstr> noamr: we think that we want to allow to scope element transitions to elements<br>
&lt;vmpstr> noamr: second, semantically group: you have the same app with different grouping of animations. you have the slide animation and expand animation and you group all elements that particpate in the animation semantically<br>
&lt;vmpstr> noamr: number three, we want the transition to be triggered by a cross document navigation. we want transitions to work in the MPA. we definitely don't want view transitions to be a deciding factor for why people pick SPA<br>
&lt;vmpstr> noamr: we want it to work with javascript and without javascript<br>
&lt;vmpstr> noamr: element scoped transitions, and btw, all those three things is not because we're planning on doing them all in one go, but just when we design each one, we want to consider everything<br>
&lt;vmpstr> noamr: we don't want to spec ourselves into a corner<br>
&lt;vmpstr> noamr: element scoped transitions is about animating a widget without stopping the whole page, so animate with drag and drop while the page is responsive<br>
&lt;vmpstr> noamr: can't do this today, but want to do it in the future<br>
&lt;vmpstr> noamr: this is sort of how you do it in javascript<br>
&lt;vmpstr> noamr: so currently the document.startViewTransition function exist. We want to have something like playerWidget.startViewTransition<br>
&lt;vmpstr> noamr: and all those pseudo elements you saw, instead of being just on the html element, any element can be the originating element: #playerWidget::view-transition-group(play-pause)<br>
&lt;vmpstr> noamr: and all animations are scoped to that<br>
&lt;vmpstr> noamr: you might have simultanious (sp) transitions running at the same time<br>
&lt;vmpstr> emilio: i wanted to ask about group. for top level VT in SPA<br>
&lt;vmpstr> emilio: view transition are fixpos / top layer, what is the rendering model for the scoped transition. A thing with view transition name would need a containing block etc<br>
&lt;vmpstr> khush: this is one of the things that we need to sketch out, like what constraints it needs. but what you saw on the previous slide, but what you saw before would happen in the iframe<br>
&lt;vmpstr> emilio: the iframe is a whole contained thing<br>
&lt;vmpstr> khush: the idea is to bring that type of containment into one element<br>
&lt;vmpstr> noamr: a lot isn't solved<br>
&lt;vmpstr> ntim: how does it work if you have a element that overlaps the scope, and you put it so it overlaps<br>
&lt;vmpstr> ntim: if you have your scope, and an element outside the scope, how does the screenshotting work<br>
&lt;vmpstr> noamr: the capture is of elements, not the screen and the overlap doesn't change<br>
&lt;vmpstr> yoav: so if there's occlusion, that doesn't change anything<br>
&lt;vmpstr> noamr: so you capture an element as an element capture, not the occluded screen capture<br>
&lt;vmpstr> noamr: with rendering and implementation for scoped element transitions, we'll have some challenges, but whenever we design the syntax for thing, we consider that the VT will not always be global<br>
&lt;vmpstr> noamr: semantic grouping, defining multiple transitions, but activating just one of them<br>
&lt;vmpstr> noamr: when we click a nav bar, it does slide, but when you click an element it expands<br>
&lt;vmpstr> noamr: these would be different animations, different pseudo elements, etc<br>
&lt;vmpstr> noamr: a lot of people struggle with this, because they define too many names, and overdefine things, or things work slowly because they have a bunch of elements<br>
&lt;vmpstr> noamr: we capture things that don't transition so you transition things that don't need to transition<br>
&lt;vmpstr> noamr: i've seen this from demos and that's something that we can fix and want to fix<br>
&lt;vmpstr> noamr: how do you fix it today? you can do it in javascript, say you want to click on details to expand<br>
&lt;vmpstr> noamr: you can set a class on &lt;html> then run the transition and then remove the class<br>
&lt;vmpstr> noamr: during the transition you know which transition ran, so when you're in the expand song class, you know what names exist<br>
&lt;vmpstr> noamr: instead we're suggesting when you startViewTransition you pass a list of ephemeral classes<br>
&lt;vmpstr> noamr: this is the css of how you would read these classes<br>
&lt;vmpstr> noamr: btw this is all bikeshed<br>
&lt;vmpstr> noamr: we thought about this a lot, but this is all bikesheddable<br>
&lt;vmpstr> emilio: one thing that jumps at me when i see that is that the way you do that means that you need to restyle the page<br>
&lt;vmpstr> emilio: and you can change a lot more than the view transition names<br>
&lt;vmpstr> trying again<br>
&lt;vmpstr> "connecting to network"<br>
&lt;vmpstr> conversation is about making a selector vs qualifying the names<br>
&lt;vmpstr> noamr: doing something with a name is a possibility we felt it was a bit limiting<br>
&lt;vmpstr> emilio: in particular for MPA, you're about to nav away from the page, I'd rather avoid doing actual work that will do render<br>
&lt;vmpstr> noamr: you need to do render into a capture, and you have something with view transition name, but you don't want the text to appear<br>
&lt;vmpstr> emilio: i'm still sad about things that require layout<br>
&lt;vmpstr> noamr: sure we can reason about doing this at the last moment<br>
&lt;vmpstr> noamr: but it's a drop in replacement for the html class name, but it's a good point, maybe we're allowing a lot of last minute things for MPA, but it's up the developers<br>
&lt;vmpstr> emilio: sure<br>
&lt;vmpstr> michael: is this ore about starting a subset of possible transition or customizing transitions or both<br>
&lt;vmpstr> noamr: both<br>
&lt;vmpstr> michael: once started the set will be on the whole document, the latter will allow multiple transitions<br>
&lt;vmpstr> khush: if your transition targets a whole document, but have multiple transitions<br>
&lt;vmpstr> noamr: this is 100% syntactic sugar, and continuation of previous CSSWG F2F, if something starts with style and ends with style, it shouldn't change the dom<br>
&lt;vmpstr> noamr: I think fantasai brought it up and it resonated with me<br>
&lt;fantasai> s/shouldn't/shouldn't be required to/<br>
&lt;vmpstr> noamr: if we decide to not do this, i'm ok with that too<br>
&lt;vmpstr> noamr: we have a type of the transition, and a slide one, and reason about them separately<br>
&lt;vmpstr> noamr: the reason we put it in the pseudo class because of hte previous thing about scoped element transitions<br>
&lt;vmpstr> noamr: the active view transition pseudo element can go into element that is a view transition route<br>
&lt;vmpstr> noamr: the third one and most improtant one is navigation triggered transition -- automatically start a transition when a document navigation takes places<br>
&lt;vmpstr> noamr: (missed)<br>
&lt;vmpstr> noamr: let's say we have the same app, and we have slide transitions and the song expands<br>
&lt;vmpstr> noamr: we want the song to be in a different document<br>
&lt;vmpstr> (reconnecting)<br>
&lt;vmpstr> noamr: we've been working with modern frameworks like nextjs, you don't build your app as MPA or SPA, you just build your app<br>
&lt;vmpstr> noamr: and sometimes the choice is done did your document load, did you pass hydration to make it an spa<br>
&lt;vmpstr> noamr: so when I think about an SPA or an MPA, i want to think about it as a detail<br>
&lt;vmpstr> noamr: it's a progressive enhancement between different cases<br>
&lt;vmpstr> noamr: they don't want to rewrite their css for different cases, so it should be more infrastructure<br>
&lt;vmpstr> noamr: so we want the song to expand whether it's the same document or cross document and work consistently<br>
&lt;vmpstr> noamr: plus we don't want to break the sort transition while we do that<br>
&lt;vmpstr> noamr: so again, reminding of the bikeshed icon<br>
&lt;vmpstr> noamr: so we define something like an event or behavior that is bidirection<br>
&lt;vmpstr> noamr: we say if we're in the same origin navigation it's to trigger them rather than not trigger, can be called enable disable or what not<br>
&lt;vmpstr> noamr: the concept is you put this in css document in both documents<br>
&lt;vmpstr> noamr: and both sides opt in to trigger a transition<br>
&lt;vmpstr> noamr: we'd read it twice: right before the last frame of the old document, and before the first frame of the new document<br>
&lt;vmpstr> noamr: this also applies to back/forward cache and prerender<br>
&lt;vmpstr> noamr: we'd read the current value of this and decide whether to trigger or skip the transition<br>
&lt;vmpstr> noamr: we also need js events or something to customize the transition, probably on both sides<br>
&lt;vmpstr> noamr: there is conversation with whatwg html spec to see if we can reach something<br>
&lt;vmpstr> noamr: but the idea is to have an event. the big use case is to have a new document that wants to use web animations not css<br>
&lt;vmpstr> noamr: then you get an event on the new document that can do that<br>
&lt;vmpstr> yoav: how is commit navigation be different in terms of negative side effects of unload<br>
&lt;vmpstr> noamr: we need to think about this, i'm hesitant to do this in unload event<br>
&lt;vmpstr> yoav: ok<br>
&lt;vmpstr> noamr: it has different htings that are different, and alternative proposals. one is it's only same origin navigation, so you'd be in the same javascript loop.. you're in the app<br>
&lt;vmpstr> noamr: the other alternative is to send a same origin redirect<br>
&lt;vmpstr> noamr: so you get a navigation event for navigation API, and get a redirect event if it redirects<br>
&lt;vmpstr> yoav: is it make it to be passive, or do we need to fire in the context of the old document<br>
&lt;vmpstr> noamr: it needs to request a frame of the old document and render into capture<br>
&lt;vmpstr> khush: one thing when we say the last frame is captured we need to define what your last frame, so we defer it until you have a navigation response<br>
&lt;vmpstr> khush: we are going to run a raf cycle and we tell the user this is the frame that will be captured, do your set up<br>
&lt;vmpstr> yoav: i' m not concerned about VT, but people using it for everything else. I want to maybe close down the event to be VT specific, but in the same way that we're limiting (missed) dismissal events<br>
&lt;vmpstr> yoav: it would be good to have preventive restrictions<br>
&lt;vmpstr> noamr: we want to be careful of people creating VT just to get this event, so i'm hesitant with artifical restrictions<br>
&lt;vmpstr> yoav: i'm not saying artificial, i'm saying you get the event, but you can't do fetch or beaconing, etc<br>
&lt;vmpstr> noamr: that's ok<br>
&lt;vmpstr> noamr: we want to be careful that is general, we don't want to say it's VT specific, because it can have an opposite effect<br>
&lt;vmpstr> khush: what i'm confused: every raf is going to need to be restricted? since raf will fire<br>
&lt;vmpstr> yoav: yeah, they'll queue raf and do weird things<br>
&lt;vmpstr> noamr: and people can do this in pagehide, we're adding an event before pagehide<br>
&lt;vmpstr> yoav: ok<br>
&lt;vmpstr> noamr: we have challenges with MPA VT, one is progressive rendering: the incoming page might not be loaded/parsed<br>
&lt;vmpstr> noamr: second is how do you deal with the lifecycle and events and footguns<br>
&lt;vmpstr> noamr: third one is in css: is navigation and event or a state, or you can say it's two events, because the state goes between two documents<br>
&lt;vmpstr> noamr: it's an event for the last frame and then for one more frame, so we're thinking more of it as an event than a state<br>
&lt;vmpstr> noamr: this is up for discussion<br>
&lt;vmpstr> noamr: this is also the first time where we define anything about navigations in css, so there was a fear of using a name like navigation for this<br>
&lt;vmpstr> noamr: this is about future proofing, maybe in the future we want to define something else here in the future, like regular keyframes that start on navigations<br>
&lt;vmpstr> noamr: maybe we want to qualify this with URLs or back/forward info<br>
&lt;vmpstr> noamr: so how do things work together, the three features we talked about<br>
&lt;vmpstr> noamr: first, you can start a view transition and give it a class<br>
&lt;vmpstr> noamr: if cross document wants to be semantically grouped, we can add @navigation and specify view-transition-classnames behavior rule<br>
&lt;vmpstr> noamr: now, our execution plan: we have two big issues we want to resolve soon<br>
&lt;vmpstr> noamr: first, global cross origin opt-in.<br>
&lt;vmpstr> noamr: second, the semantic grouping.<br>
&lt;vmpstr> noamr: i feel like if we have two those things, plus the html events, javascript style, and we resolve these two things in the lifecycle and people can play with MPA VT<br>
&lt;vmpstr> noamr: later on we plan to get to element view transition and expand navigation for url/back navigation/etc<br>
&lt;vmpstr> noamr: this is what we want to do first: navigation trigger for MPA, and readytorender event that maybe gives you a view transition that you can work with<br>
&lt;vmpstr> noamr: and semantic grouping where you set classes and respond to them<br>
&lt;vmpstr> noamr: step c is to combine these two things together<br>
&lt;khush> q?<br>
&lt;vmpstr> noamr: questions? comments?<br>
&lt;vmpstr> michael: for cross document navigations, i understand the desire to limit the need for js, and there is a navigation api now and so you're potentially firing these events at a similar time to intercept<br>
&lt;vmpstr> noamr: yes, for outgoing<br>
&lt;vmpstr> michael: so there is a problem for when to load, and end, and you have a placeholder like a spinner<br>
&lt;vmpstr> noamr: yes, currently for the new document, this doesn't help us at all since there are no navigation events<br>
&lt;vmpstr> noamr: for old document we thought about dealing with navigate event but also adding something for redirects<br>
&lt;vmpstr> noamr: so you want this not just for things clicked in the page<br>
&lt;vmpstr> noamr: we do want to make this work well together<br>
&lt;astearns> ack fantasai<br>
&lt;vmpstr> fantasai: if you're just doing a declarative transition between pages, there is some ttype of syntax that enables that, some class navigation<br>
&lt;vmpstr> noamr: right now, it's just @navigation same-origin<br>
&lt;vmpstr> fantasai: and what is same-origin what else can you put there?<br>
&lt;eeeps> q+<br>
&lt;vmpstr> noamr: right now nothing, but as a reader you can see this applies to same origin navigation, and later we'll be putting things that map to url patterns / back reload<br>
&lt;vmpstr> noamr: like you define what is a song page and play a page and a navigation between them has a class list expand<br>
&lt;vmpstr> noamr: we didn't want to get into this, but we had some ideas about this, navigation is always qualified by some urls, so you might have to specify something at least as broad as same origin<br>
&lt;vmpstr> noamr: we might also want to expand this to something that isn't same origin, we don't want existing pages to immediately upgrade to that without changes<br>
&lt;vmpstr> fantasai: i think it would be a good idea to fully explore the same, since the decision we make here we'll be trapping ourselves here, although we don't want to implement things we want to explore we'd want to put in here<br>
&lt;vmpstr> fantasai: in terms of mapping urls to classes of navigations, then can the page ... if you don't have the url or an obvious pattern, like it's a random identifier, which isn't great from url perspective but we shouldn't care, then you can't map a url pattern to types<br>
&lt;vmpstr> fantasai: can we handle these cases<br>
&lt;khush> q+<br>
&lt;vmpstr> noamr: we explored things to the group and we can explore this internally and explore it tomorrow<br>
&lt;fantasai> s/explore the same/explore the space/<br>
&lt;vmpstr> noamr: this is about navigation urls and types which is (missed)<br>
&lt;khush> q-<br>
&lt;vmpstr> noamr: about url patterns, we can go this way forever and in the end you can do things in javascript. if you can't map things declaratively you can do script (or in the server)<br>
&lt;vmpstr> noamr: we also don't want to work on the javascript api to work on this navigation<br>
&lt;vmpstr> eeeps: is this feature limited to same origin navigations or is cross origin in scope<br>
&lt;vmpstr> noamr: not in scope<br>
&lt;vmpstr> eeeps: but are there cases for this<br>
&lt;ntim> we're out of time fwiw<br>
&lt;vmpstr> noamr: maybe same site, or first party set<br>
&lt;vmpstr> noamr: join us tomorrow for details<br>
</details>


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


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

Received on Wednesday, 13 September 2023 15:01:29 UTC