-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
View Transitions API #677
Comments
A few other relevant links: TAG review: w3ctag/design-reviews#748 |
Hi @khushalsagar! There's a lot to digest here, so I think it will take us some time to form a position. But a couple of us took a look and I wanted to share some first impressions. These are important use cases, so appreciate the effort put towards it and I can tell a lot of thought has been put into it. But I have to admit I'm finding it fairly complex to learn. I don't know yet if it's just because the problem is complex, or if there are any ways to simplify it and still solve the most important use cases. My primary questions are around the end-user experience on MPAs - as it's listed as a top use case, it's where new capabilities are being introduced, and (AIUI) it hasn't been prototyped yet & still has some open questions on the design.
Secondarily, I find the use of the large nested pseudo-element trees a little hard to follow. Not saying it's wrong, but I suspect a lot of people will find it non-obvious. I'm curious if other alternatives were explored. For example, putting a UA shadow DOM on the root element and then styling via shadow parts may be a way to avoid exposing the implementation details around nesting and handling deep pseudo trees from selectors. Happy to take that to the repo to discuss in more detail but just wanted to check if there's been prior discussion on that topic before doing that. |
Thanks for the feedback @bgrins, appreciate your considerations on this. I have added responses inline below to the questions raised:
The primary goal with the current API has been to layer the feature on top of existing web concepts to make it easy for developers to learn and use the feature. If you have suggestions for any part of the API which could be made simpler, happy to discuss more.
It’s trivial to simulate a delay with the SPA app, the API allows the developer to control how long to wait for the next page to load before starting the animation. For example, click on any of the thumbnails in the pages below:
These examples rely on the browser spinner to indicate 'loading', rather than in-page spinners, which would be more 'traditional' for SPAs. Note: Since these demos are using this feature, you’ll need to load them in Chrome canary and enable chrome://flags/#document-transition.
No, this feature doesn’t add any increase to the amount of time to show the new page (modulo the time for the animation itself). The animation starts with the first frame rendered by the new page. That said, there is a trade-off between quickly switching to the next page (and loading/rendering incrementally) vs adding a reasonable delay so the next page is ready for a transition. But that tradeoff is there regardless of whether the switch is instant or involves an animation (that this feature adds). Our strategy is to enable devs to make that trade-off for MPAs (similar to SPAs) with independent features that can be combined with this API.
Makes sense. Our thinking for cross-origin is that it should be a subset of the capabilities for same-origin. For example,
We did discuss this internally and the choice was between shadow DOM and pseudo-elements. We didn't want to use the html element directly as the shadow host since this prevents the developer from attaching their own shadow DOM to the root element and creates compat risk. We tried adding a pseudo-element to the html element which could be the shadow host. But that ran into issues with multiple features using flattened tree traversal that don’t expect pseudo-elements to be shadow hosts. Pseudo-elements proved to be easier to implement and weren't limiting any of the capabilities required. There was already precedent for nested pseudo-elements for marker so any gaps (for instance with better selectors for nested pseudo-elements) would help those use-cases too. The shadow DOM approach required exposing pseudo-element references to developers, so they could customize the animation. So the developer API surface was quite similar for styling the browser generated DOM. Please do file an issue to discuss this further, particularly if you have concerns that this is a limiting design choice. |
Thank you for the response @khushalsagar, and for taking the time to put together the demo pages with various latencies. That does help illustrate the experience to me - I did a side by side manual test in Chrome stable and canary with the flag on. In these variations where the simulated "new" document is already fully loaded/rendered I think the experience felt nice and avoided the uncanny valley concern I had even with the larger delays. I'll be curious as the prototype advances to see how it feels in actual MPAs and where the new state is progressively rendered (either because resources aren't render-blocking or because it hits a UA timeout). For example, if animating in to a missing or low-res version of an image that's present in the old state. |
Can you elaborate? You could argue that pages with JS could make the |
We can get a new issue on file in https://github.com/WICG/shared-element-transitions for the shadow parts discussion specifically |
Heads up, we'll have a session on this feature at TPAC on Wednesday. I'll post the exact time next week. Looking forward to see folks interested there! |
The breakout session is on September 14 at 3 PST. Details are here including a link to join virtually. |
We recently discussed the question of shadow DOM vs pseudo-elements at CSSWG here. The resolution was to take the pseudo-element syntax. @bgrins @emilio does that address your concerns on #190? Also, are there any other design aspects about this feature you'd like to discuss more? We'd like to make edits to the html spec pertaining to this feature. This includes the change to add render-blocking and transition steps invoked during update the rendering described in the view transitions spec here. Could you please provide Mozilla's position for these changes. |
Yeah, I'm ok with the CSSWG resolution regarding syntax. Reviewing a bit the spec, I'm confused about the second monkey-patch here?
I also still think that this should probably not be shipped without the same-origin multi-page support tho. It seems rather unfortunate to provide features for SPAs that MPAs can't support. |
Ah, that's my bad. The changes under monkey-patches need to go in the html spec. I had opened a PR to land it there, but erring on moving all html specific changes to that spec once the CSS spec has been accepted for CR. Just sent a change to fix the spec text in the CSS spec, feel free to review it.
Completely agreed on the second point, this must be supported for MPA. We're actively working on it, there is a prototype you can try on Chrome canary. Just need to enable view-transition-on-navigation and add the following meta tag to both Documents: <meta name="view-transition" content="same-origin"> All cross-document same-origin navigations to/from this Document will have a ViewTransition. The CSS is the same as the SPA API for customizing it. The UA CSS is also the same, which is why you get a cross-fade by default. There are also open issues in CSSWG labelled "css-view-transitions-2" to discuss MPA specific parts of this API, like #8048 for this opt-in moving to CSS. But we don't want to block shipping the SPA API until multi-page support. The feature is already structured to have the same rendering model, and CSS/JS syntax for customization; in both SPA/MPA. The only part specific to MPA is how and which navigations trigger a transition and SPA shipping doesn't need to block on this. |
(note, @khushalsagar sent intent-to-ship for the same-page API, in Chromium/Blink.) |
We're supportive of View Transitions, but since it's a new capability for MPAs in particular, we think it's important that the solution works well for MPAs and that it's consistent with the solution for SPAs. As such, if design changes are needed for the MPA use case that also affect SPA API, the latter should be updated as appropriate even though it has shipped. In other words, we think it would be bad for the SPA and MPA APIs to diverge or be inconsistent. |
Fwiw, we took a break from developing the SPA part of the API to sketch out a bunch of future-features we think we might want as part of view transitions. Eg https://github.com/WICG/view-transitions/blob/main/explainer.md#cross-document-same-origin-transitions and https://github.com/WICG/view-transitions/blob/main/explainer.md#future-work. These sketches are incomplete, and a little out of dates, but we considered their fundamentals when working on the SPA feature. For example, we technically don't need I'm confident we won't need breaking changes to the existing model for MPA, but if we need to, we'll do it. I think it's more likely that declarative features will be added to support the MPA case, and we add those into the SPA API as enhancements. For example, with MPA, I think we need some higher-level indication of a navigation being back rather than forward/replace. If we add that for MPA, we'll look to add it for SPA too. Sorry, that's basically a long way of saying "yes I agree". |
@zcorpan is this RFP enough for cross-document transitions or should we file a new one? |
This one is sufficient IMO. |
@zcorpan - similar question: Chromium's planning to ship some pieces of cross-document view transitions separately - currently up is the |
@bokand we can include |
Request for Mozilla Position on an Emerging Web Specification
Other information
The spec still has some open issues but the overall feature design is concrete at this point. Also here is the chrome status entry.
The text was updated successfully, but these errors were encountered: