-
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
Deferring (same-origin) navigation commit #10716
Comments
I'm a bit worried that this would make history traversal slow. The whole point of having a bfcache is so it's snappy to hit the back button. This would make the end user experience worse. |
Not sure if we need to support this for history traversals. But yea it's one of these points where a smooth UI sometimes means a delay. |
I've been running into this situation trying to design an ideally responsive user experience using cross-document View Transitions. Because cross-doc VTs must wait for the next page to render, and in some cases it's ideal to use a render blocking attribute to wait for a shared element on the next page, it's possible and even common for a cross-doc VT to blow past RAIL guidelines. All of the approaches I've considered so far have significant tradeoffs, and this proposal would help minimize the tradeoffs. Approach 1: Approach 2: Approach 3: Ideally, the solution would allow the following:
I understand the potential for accidentally misusing this feature, but it seems far better to offer this capability than making the default for c-d VTs require a network round trip in order to give visual feedback to user input which goes against RAIL, INP guidelines, and overall UX. I know one of the recommended solutions is prefetching + prerendering, but that's not always an option. Some version of this, even with limitations, sounds like it can provide a viable solution. |
What problem are you trying to solve?
Sometimes when performing a (same-origin) navigation, the old page wants to perform some potentially async operations. This could be e.g. putting something into storage, or even completing an animation or some other UI flow in the context of the old page.
What solutions exist today?
To achieve that today, the old page has to intercept the navigation, e.g. with
NavigateEvent.intercept
or by capturing clicks, and then re-trigger the navigation once the operation is complete.However, this is far from ideal, as the interception aborts the navigation fetch, creating a lag once the old page is ready to proceed. What's needed here is deferring rather than intercepting the navigation.
How would you solve it?
Proposing to add a capability to defer a
PageSwapEvent
, similar (or identical) to service worker'sExtendableEvent
.This would look like this:
Anything else?
Other alternatives considered:
NavigateEvent.defer
, similar toNavigateEvent.intercept
: feels like something related to same-document navigation, while this is more about same-origin commits ("page swap").intercept
to have this new behavior with an option. Feels like this overloads something that has a clear purpose with additional purposes, creating unnecessary confusion.The text was updated successfully, but these errors were encountered: