-
Notifications
You must be signed in to change notification settings - Fork 56
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
Cross-document View Transitions API #851
Comments
@atanassov @LeaVerou FYI. |
Hi @noamr! We were happy to see cross-stakeholder support, though we'd like to see WebKit’s position as well. We also liked the secure-first design, with two-way opt-in and a same-origin restriction. Is cross-origin a non-goal because there are few use cases for it, or because you are not confident in the security of a cross-origin opt-in? It seems a little inflexible to have the opt-in be HTML (as you point out); A CSS mechanism would indeed be preferable, though the proposed syntax is not idiomatic to CSS, since there is no precedent of @-rules that take values (this does not necessarily mean this is a bad idea, but when something creates a new precedent, we should spend extra effort to make sure there is no alternative design that is more consistent with the existing Web Platform without sacrificing usability. Props for a declarative-first API too! We had a few questions, that we didn't find the answers to in the explainer:
|
Hi @LeaVerou, thanks for reviewing! Some answers inline.
We see same-site cross-origin as a potential future enhancement. And even that is not devoid of security (and other) issues. All that said, who knows what the future holds. It's mainly a non-goal for now to allow us to focus on what we know are important and feasible use-cases.
We're thinking the same... See proposed update to this explainer or some such, which would be consistent with font-face and page rules.
The transition happens, no need for JS. The JS API is useful for:
But it's by no means necessary for the common case.
This is another reason why this would be challenging in a cross-origin setting. The context where we see people using this is an "MPA", where the user journey in the entire app, across documents, is tested by the developer.
You mean if the old document starts the transition and the new document skips it? The moment the transition is skipped we'd render the new document's "final" (post-transition) state. This is not different from skipping a same-document transition. |
Some details to add to @noamr's response.
Btw, you can see this in action on a prototype in Chrome by turning on chrome://flags/#view-transition-on-navigation. Transitions occur for any same-origin navigation where both Documents have the meta tag to opt-in. The opt-in syntax aside, transitions work using the same declarative method of adding
The old Document remains active and animating until the browser gets a response from the server. For example, when the user clicks a link they usually see some browser UI indicating that the navigation was initiated. The user sees content animating and they can scroll around until the browser receives a response, at which point the old Document is unloaded to be replaced by the new Document. The flow remains exactly the same until the browser receives a response. But the browser caches a snapshot of the old Document before unloading it (or placing it in BFCache). Then there is a wait to stream in the new Document + sub-resources before the transition can start, which builds on top of render-blocking. Render-blocking already has a timeout associated with it. We don't abort the transition if the timeout is hit for any sub-resource so devs have the option to design their own fallback (one of which can be aborting the transition). |
Heads up, an Editor's draft for the spec is here. Would appreciate if you can consider it for the review. |
Hi @noamr and @khushalsagar , We looked at this during a breakout today. A few clarifications about my earlier comments: On no JS used: We're still unclear on what happens if no JS is used, from the user’s point of view. What transition happens? Like, is it a cross-fade? Something else?
Detecting a slow network is notoriously difficult (and not really black & white, you may have had a perfectly fine connection until now), so I don't think the API should depend on it for a baseline decent end-user experience. On that note, it would be good if the CSS code to opt-in to this can be nested within media queries (e.g. see
That’s promising! Though in slow connections the time from receiving a response to actually being able to animate to the new document can still be fairly long. But if the user perceives it as just slightly longer loading times, I guess that's not a huge issue. It may be a good idea to advise UAs to start their loading UI when the navigation starts, so that the user does get some feedback that something is happening (possibly in a non-normative note).
I meant if the navigation doesn't happen at all because the event was cancelled. |
If the author doesn't provide any JS or CSS, i.e. the only addition to the Document is the opt-in, there will be a cross-fade from UA style rules. But customization can be done using CSS. Load https://valuable-vigorous-sailor.glitch.me/index.html on chrome canary with chrome://flags/#view-transition-on-navigation enabled. The header stays in position (because it has a Our goal is to ensure that simple customization can be purely declarative. But if you need something more complicated, like navigating from a list to the details page of a list item, it requires script. Since the author needs to add a
That's a fair point. The spec can add a recommendation for UAs, something like: "The UA should skip the transition if there is a significant delay between when the navigation was initiated and when the new Document is no longer render-blocked". The precise threshold for skipping can be left to the UA?
+1, media-query support is fundamental to the CSS syntax. Both for the exiting query for prefers-reduced-motion and our long term thinking of adding media queries to allow customization based on the old/new Document URL (see w3c/csswg-drafts#8925). On that note, we had a discussion today about the ordering subtlety with media queries. For example, if the author CSS is as follows: @media (prefers-reduced-motion) {
@view-transitions {
navigation-trigger: cross-document;
}
}
@view-transitions {
navigation-trigger: cross-document;
} Then the media-query declaration would be a no-op since the second rule would win. This is because media queries by design don't add any specificity. We were wondering whether we should have a bespoke syntax to add specificity (instead of media queries) for customizing based on old/new Document URLs. Doesn't seem worth the complexity since authors will have to ensure correct ordering for other queries like
Sure. FWIW that's what Chrome is doing but we can add a non-normative note as a recommendation to UAs.
Ah ok. If the navigation is cancelled (script cancelled it, the user hit stop, there was a 204 response), then no transition occurs. On the old Document the only customization an author can do is which elements get a |
Hi @khushalsagar, Thanks for your response! I cannot speak for the rest of the TAG before discussing it again, but all sounds good to me.
This sounds like an issue to bring up with the CSS WG. FWIW it sounds like this may be adding to the pile of use cases for a selector that represents the document itself. |
Oops, my bad. It was supposed to be:
Sounds good. We'll be discussing the new at-rule with the group soon, will bring it up then. |
Looking at the issue @hober during our virtual f2f and following all threads, we agree with @LeaVerou and are happy to resolve it. Looking forward to seeing this feature adopted and in use. Thank you for flying TAG. @LeaVerou please close once you have a chance to confirm your concerns are addressed. |
Hello TAG! We're planning to ship the We're wondering if the review here was sufficient for TAG purposes or if you'd prefer we file a new review issue to look specifically at the event. @LeaVerou (for visibility) |
Friendly ping - @LeaVerou @atanassov @hober |
FYI: we're getting ready to ship the @LeaVerou @atanassov @hober - Given it's a fairly minor piece and has had vigorous discussion in whatwg/html#9315 I'm inclined to think this doesn't need a TAG review separate from this issue but please chime in if you disagree and I can file a separate review. Thanks! |
Hello again! Similar to Explainer: https://github.com/WICG/view-transitions/blob/main/cross-doc-explainer.md#pageconceal Please let me know if you'd prefer a separate TAG review for this event. |
FYI, the event has been renamed |
Another fyi, we're proposing a minor change to |
こんにちは TAG-さん!
I'm requesting a TAG review of Cross-document View Transitions API (css-view-transitions-2).
Cross-document transitions are an extension to same-document transitions, adding the semantics necessary to display transitions when navigating across documents.
Further details:
You should also know that...
See design review for same-document transitions: #748
We'd prefer the TAG provide feedback as (please delete all but the desired option):
☂️ open a single issue in our GitHub repo for the entire review
CAREFULLY READ AND DELETE CONTENT BELOW THIS LINE BEFORE SUBMITTING
Please preview the issue and check that the links work before submitting.
In particular:
¹ For background, see our explanation of how to write a good explainer. We recommend the explainer to be in Markdown.
² Even for early-stage ideas, a Security and Privacy questionnaire helps us understand potential security and privacy issues and mitigations for your design, and can save us asking redundant questions. See https://www.w3.org/TR/security-privacy-questionnaire/.
The text was updated successfully, but these errors were encountered: