WICG / portals

A proposal for enabling seamless navigations between sites or pages
https://wicg.github.io/portals/
Other
947 stars 66 forks source link

Leaning on bfcache and history traversal #175

Closed jakearchibald closed 4 years ago

jakearchibald commented 4 years ago

Portal activation and how I imagine the back button might work seems to have a lot in common with bfcache. I wonder if we can lean on it and avoid spec'ing a whole new kind of navigation.

Activating a portal

Instead of step 4 of 'activate a portal browsing context', call update the session history with the new page, with the following changes according to a "isPortalActivation" flag:

The HTML steps here talk about a "new entry" which is really hand-waved. For portals, we should create an entry that has a fromPortal flag, which would be a new field of a session history entry.

The above steps involve traversing the history, but I don't see anything that would need to change.

Unloading

It feels like we have two options: perform the closing steps before switching the documents, or do it afterwards. In terms of closing before switching documents:

Pros:

Cons:

Now I've written it down, it feels better to continue to do what the spec is currently doing, and only run the close steps once the adopted portal is closed.

Traversing history

This would automatically use traverse the history by a delta:

Traversals that aren't 1 or -1 should just work, as the session entry's document would be promoted as if it were a bf cached page.

I haven't thought much about the event names yet.

jakearchibald commented 4 years ago

I'm going to close this. I think we have consensus that portals and bfcache need to interact in some way. I'll create additional issues for specific details as they come up.