-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Consider adding view-transition
as a token for blocking
#10513
Comments
+1 to the idea. The VT spec already states that the browser should timeout the transition if the navigation is taking long. This token would also allow the UA to know which elements were blocking for a transition and timeout them at the same time. |
|
Both! |
Thinking about this from a user-centric angle using guidance like https://web.dev/articles/rail and even personal experience, I have to imagine there's a small range for a good default render-blocking timeout in the 3-5 second range. Any longer and the navigation will start to feel quite broken and lead to significantly higher abandonment. I accidentally did this on a slice of traffic experimenting with cross-origin VTs and it showed up immediately in metrics. Much shorter than 3 seconds and it won't be long enough for many sites. Another option if a developer wants a different timeout is to make it declarative:
Is there a reason to skip the view-transition, vs just running it with whatever elements are enabled? If I hit the timeout and was trying to wait for a shared element that didn't load fast enough, my preference would be playing the transition with the root element and whatever shared elements are available. I suppose this might cause unexpected animations especially for the outgoing snapshots? |
It's the inverse, if the element was render-blocking only because it was required by a view transition and the UA has hit an internal timeout then the Document no longer needs to stay blocked on that element. In Blink that timeout is 4s. |
VT aside, is showing unstyled content that may look extremely broken after 5s better? Hard to tell.
Yea it's going to be hard to debug this as different race conditions would produce different animations. |
I would suggest yes as a default, a user on that slow of a connection/device likely already sees similar janky experiences on plenty of sites, and also has to decide based on visual feedback if their connection is stalled and they need to abandon or refresh. The visual feedback that something is still loading feels far superior to a frozen page with no apparent progress. An explicit timeout would allow a site to say that they know better and want to wait longer if their situation truly justifies it, similar to how a page could choose to 'display: none' content if they really wanted. The other solution would be a loading state, which VTs and render blocking don't have strong support for. I haven't tried, but perhaps it could be built on the outgoing page. |
@nickcoury an aggressive timeout could be considered for parsing/script where authors explicitly opt-in to render blocking. I'd be considered about compat if we did it for stylesheets which are render-blocking by default and have been for a long time now. |
I was specifically thinking about the new tag since blocking on an #id seems inherently more risky if it's not actually in the doc. Agreed this wouldn't make sense to apply to all render blocking cases. |
What problem are you trying to solve?
Render-blocking has been a mechanism for curating the incremental rendering experience, and avoiding layout shifts and FoUC. With the introduction of cross-document view transitions, render-blocking is now also used to delay rendering a bit until the expected content for the view-transition is available.
This can result in two unwanted scenarios:
What solutions exist today?
It's quite easy to create a script with
setTimeout
and unblock the elements.However, to know in advance whether there is an inbound view transition, the developer has to get that information in the
pageswap
event handler and save it tosessionStorage
. This can be mess.Also none of these solution provide a default UA timeout.
How would you solve it?
Suggesting to add
blocking="view-transition"
for elements that support theblocking
attribute. This attribute would work in the following way:blocking=render
Anything else?
Alternatives: Expose
hasViewTransition
boolean inNavigationActivation
. This allows knowing in advance if there is an inbound view transition without waiting for thepagerevealevent
./cc @eeeps @chrishtr @zcorpan
The text was updated successfully, but these errors were encountered: