Intent to Ship: 'pageswap' event

664 views
Skip to first unread message

Khushal Sagar

unread,
Feb 29, 2024, 6:11:58 PMFeb 29
to blink-dev, Noam Rosenthal

Contact emails

khusha...@chromium.orgnrose...@chromium.org

Explainer

https://github.com/WICG/view-transitions/blob/main/cross-doc-explainer.md#pageconceal

Specification

https://html.spec.whatwg.org/#the-pageswapevent-interface

Summary

The `pageswap` event is fired on a Document's window object when a navigation will replace this Document with a new Document. The event provides activation info about the navigation (type, NavigationHistoryEntry for the new Document). If the navigation has a cross-document ViewTransition, the event is dispatched before capturing state for the old Document. This allows the page-author to configure the old state captured for the transition based on the navigation's activation info and the current visual state of the old Document. This feature is split out from the larger ViewTransition-on-Navigation project.


Blink component

Blink>ViewTransitions

TAG review

https://github.com/w3ctag/design-reviews/issues/851#issuecomment-1924730258

TAG review status

Pending

Risks


Interoperability and Compatibility

None


Gecko: Positive (https://github.com/mozilla/standards-positions/issues/969)

WebKit: No signal (https://github.com/WebKit/standards-positions/issues/313)

Web developers: Strongly positive This is one of the building blocks for cross-document View Transitions which has high developer demand.

Other signals:

WebView application risks

Does this intent deprecate or change behavior of existing APIs, such that it has potentially high risk for Android WebView-based applications?

None



Debuggability

None



Will this feature be supported on all six Blink platforms (Windows, Mac, Linux, ChromeOS, Android, and Android WebView)?

Yes

Is this feature fully tested by web-platform-tests?

Yes

https://wpt.fyi/results/html/browsers/browsing-the-web/history-traversal/pageconceal?label=experimental&label=master&aligned. A PR to rename the event to pageswap in WPTs is in flight.



Flag name on chrome://flags

PageSwapEvent

Finch feature name

PageSwapEvent

Requires code in //chrome?

False

Tracking bug

https://issues.chromium.org/issues/41495176

Estimated milestones

Shipping on desktop124
Shipping on Android124
Shipping on WebView124


Anticipated spec changes

Open questions about a feature may be a source of future web compat or interop issues. Please list open issues (e.g. links to known github issues in the project for the feature specification) whose resolution may introduce web compat/interop risk (e.g., changing to naming or structure of the API in a non-backward-compatible way).

None

Link to entry on the Chrome Platform Status

https://chromestatus.com/feature/5479301497749504

Links to previous Intent discussions

Intent to prototype: https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAMLuWUyCjahhiLy_%2B3mXTfF9v8h0T7tuZRa2FujT1qn_%3DXfQpw%40mail.gmail.com

This intent message was generated by Chrome Platform Status.

Chris Harrelson

unread,
Feb 29, 2024, 6:16:18 PMFeb 29
to Khushal Sagar, blink-dev, Noam Rosenthal
On Thu, Feb 29, 2024 at 3:11 PM 'Khushal Sagar' via blink-dev <blin...@chromium.org> wrote:


--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAMLuWUx41iLjW2A7LuvQfv95EOrVGh_969kit4WjuGZiu0ZhbQ%40mail.gmail.com.

Yoav Weiss (@Shopify)

unread,
Mar 6, 2024, 5:38:24 AMMar 6
to Chris Harrelson, Khushal Sagar, blink-dev, Noam Rosenthal
On Fri, Mar 1, 2024 at 12:16 AM Chris Harrelson <chri...@chromium.org> wrote:


On Thu, Feb 29, 2024 at 3:11 PM 'Khushal Sagar' via blink-dev <blin...@chromium.org> wrote:


 


Specification

https://html.spec.whatwg.org/#the-pageswapevent-interface

Summary

The `pageswap` event is fired on a Document's window object when a navigation will replace this Document with a new Document. The event provides activation info about the navigation (type, NavigationHistoryEntry for the new Document). If the navigation has a cross-document ViewTransition, the event is dispatched before capturing state for the old Document. This allows the page-author to configure the old state captured for the transition based on the navigation's activation info and the current visual state of the old Document. This feature is split out from the larger ViewTransition-on-Navigation project.


Why is it split out? Is there some utility for this regardless of view transitions?
 

Blink component

Blink>ViewTransitions

TAG review

https://github.com/w3ctag/design-reviews/issues/851#issuecomment-1924730258

TAG review status

Pending

Risks


Interoperability and Compatibility

None


Gecko: Positive (https://github.com/mozilla/standards-positions/issues/969)

Is that the right position?
 

Noam Rosenthal

unread,
Mar 6, 2024, 5:55:01 AMMar 6
to Yoav Weiss (@Shopify), Chris Harrelson, Khushal Sagar, blink-dev, Noam Rosenthal


Summary

The `pageswap` event is fired on a Document's window object when a navigation will replace this Document with a new Document. The event provides activation info about the navigation (type, NavigationHistoryEntry for the new Document). If the navigation has a cross-document ViewTransition, the event is dispatched before capturing state for the old Document. This allows the page-author to configure the old state captured for the transition based on the navigation's activation info and the current visual state of the old Document. This feature is split out from the larger ViewTransition-on-Navigation project.


Why is it split out? Is there some utility for this regardless of view transitions?
 
Absolutely! For example it's a place where you can figure out that you're navigating away to a different same-origin document (after redirects), and act on it in some way, e.g. put something in `sessionStorage` like a video playback position.
It's different from `pagehide` in that sense, because with `pagehide` you don't know you're going to a new document.

Also by having a generic event with an optional viewTransition property, it can tell the author that a view transition *didn't* take place, which we can't do with a view-transition event.

The design for this (as for `pagerveal`) started from view-transition-specific events and ended up gravitating towards this kind of event with an optional attribute for this reason, and also to avoid a situation where people create fake view transitions for the purpose of getting these events.
 
 

Blink component

Blink>ViewTransitions

TAG review

https://github.com/w3ctag/design-reviews/issues/851#issuecomment-1924730258

TAG review status

Pending

Risks


Interoperability and Compatibility

None


Gecko: Positive (https://github.com/mozilla/standards-positions/issues/969)

Is that the right position?
 
Yes, the name was changed while iterating, but it's the same feature and Gecko folks took active part in the design and reviews.

Yoav Weiss (@Shopify)

unread,
Mar 6, 2024, 5:58:01 AMMar 6
to Noam Rosenthal, Chris Harrelson, Khushal Sagar, blink-dev, Noam Rosenthal
LGTM1

On Wed, Mar 6, 2024 at 11:54 AM Noam Rosenthal <nrose...@chromium.org> wrote:


Summary

The `pageswap` event is fired on a Document's window object when a navigation will replace this Document with a new Document. The event provides activation info about the navigation (type, NavigationHistoryEntry for the new Document). If the navigation has a cross-document ViewTransition, the event is dispatched before capturing state for the old Document. This allows the page-author to configure the old state captured for the transition based on the navigation's activation info and the current visual state of the old Document. This feature is split out from the larger ViewTransition-on-Navigation project.


Why is it split out? Is there some utility for this regardless of view transitions?
 
Absolutely! For example it's a place where you can figure out that you're navigating away to a different same-origin document (after redirects), and act on it in some way, e.g. put something in `sessionStorage` like a video playback position.
It's different from `pagehide` in that sense, because with `pagehide` you don't know you're going to a new document.

Also by having a generic event with an optional viewTransition property, it can tell the author that a view transition *didn't* take place, which we can't do with a view-transition event.

The design for this (as for `pagerveal`) started from view-transition-specific events and ended up gravitating towards this kind of event with an optional attribute for this reason, and also to avoid a situation where people create fake view transitions for the purpose of getting these events.

Makes sense!
 
 
 

Blink component

Blink>ViewTransitions

TAG review

https://github.com/w3ctag/design-reviews/issues/851#issuecomment-1924730258

TAG review status

Pending

Risks


Interoperability and Compatibility

None


Gecko: Positive (https://github.com/mozilla/standards-positions/issues/969)

Is that the right position?
 
Yes, the name was changed while iterating, but it's the same feature and Gecko folks took active part in the design and reviews.

Ooh, got it! 

Manuel Rego Casasnovas

unread,
Mar 6, 2024, 6:32:26 AMMar 6
to Yoav Weiss (@Shopify), Noam Rosenthal, Chris Harrelson, Khushal Sagar, blink-dev, Noam Rosenthal
What's going on with the tests?

https://wpt.fyi/results/html/browsers/browsing-the-web/history-traversal/pageswap?label=master&label=experimental&product=chrome&product=firefox&product=safari

Thanks,
Rego
> <https://bugs.chromium.org/p/chromium/issues/list?q=component:Blink%3EViewTransitions>
>
>
> TAG review
>
> https://github.com/w3ctag/design-reviews/issues/851#issuecomment-1924730258 <https://github.com/w3ctag/design-reviews/issues/851#issuecomment-1924730258>
>
>
> TAG review status
>
> Pending
>
>
> Risks
>
>
> Interoperability and Compatibility
>
> None
>
>
> /Gecko/: Positive
> (https://github.com/mozilla/standards-positions/issues/969 <https://github.com/mozilla/standards-positions/issues/969>)
>
>
> Is that the right position?
>
> Yes, the name was changed while iterating, but it's the same feature
> and Gecko folks took active part in the design and reviews.
>
>
> Ooh, got it!
>
> --
> You received this message because you are subscribed to the Google
> Groups "blink-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to blink-dev+...@chromium.org
> <mailto:blink-dev+...@chromium.org>.
> To view this discussion on the web visit
> https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAOmohSKjwe8bHquJ09vUW%2BeSvXr3tuBASCOKh1SAk7ay4Fay4Q%40mail.gmail.com <https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAOmohSKjwe8bHquJ09vUW%2BeSvXr3tuBASCOKh1SAk7ay4Fay4Q%40mail.gmail.com?utm_medium=email&utm_source=footer>.

Khushal Sagar

unread,
Mar 6, 2024, 10:58:51 AMMar 6
to Manuel Rego Casasnovas, Yoav Weiss (@Shopify), Noam Rosenthal, Chris Harrelson, blink-dev, Noam Rosenthal
The code to dispatch this event is partly in the browser process, so turning on experimental web features doesn't enable the flag there. We have a virtual tests suite to run the test on the bots, won't be necessary once we switch runtime feature status to stable.

Daniel Bratell

unread,
Mar 6, 2024, 11:21:42 AMMar 6
to Khushal Sagar, Manuel Rego Casasnovas, Yoav Weiss (@Shopify), Noam Rosenthal, Chris Harrelson, blink-dev, Noam Rosenthal

LGTM2

/Daniel

To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAMLuWUzQKfk7EzQ%3DLA6R2Stq0pj-VgrhZpgfAyaAJA1P16BJJA%40mail.gmail.com.

Chris Harrelson

unread,
Mar 6, 2024, 11:28:01 AMMar 6
to Daniel Bratell, Khushal Sagar, Manuel Rego Casasnovas, Yoav Weiss (@Shopify), Noam Rosenthal, blink-dev, Noam Rosenthal

Khushal Sagar

unread,
Mar 12, 2024, 6:26:10 PMMar 12
to Chris Harrelson, Daniel Bratell, Manuel Rego Casasnovas, Yoav Weiss (@Shopify), Noam Rosenthal, blink-dev, Noam Rosenthal
Hey folks,

There's a minor change to the semantics of this event based on security feedback: https://github.com/whatwg/html/issues/10196. Originally we provided the activation info if the navigation is same-origin. The proposed change is to limit it further to same-origin navigations with no cross-origin redirects. I'll wait for this issue to be resolved before shipping the feature.

Let me know if another review is needed for the proposed change or this intent is still good to go.

Thanks.
Khushal

Domenic Denicola

unread,
Mar 12, 2024, 9:47:06 PMMar 12
to Khushal Sagar, Chris Harrelson, Daniel Bratell, Manuel Rego Casasnovas, Yoav Weiss (@Shopify), Noam Rosenthal, blink-dev, Noam Rosenthal
Assuming that change gets appropriate spec updates and web platform tests coverage, that should be no problem. Thanks to you and the security team for looking out for our users!

Reply all
Reply to author
Forward
0 new messages