WebKit / standards-positions

WebKit's positions on emerging web specifications
https://webkit.org/standards-positions/
243 stars 19 forks source link

Disabling UA transitions for same-document navigations #177

Open khushalsagar opened 1 year ago

khushalsagar commented 1 year ago

WebKittens

@smfr

Title of the spec

Disabling UA transitions for same-document navigations

URL to the spec

https://github.com/w3c/csswg-drafts/issues/8747

URL to the spec's repository

No response

Issue Tracker URL

No response

Explainer URL

https://github.com/WICG/view-transitions/blob/main/default-ua-transitions.md

TAG Design Review URL

https://github.com/w3ctag/design-reviews/issues/835

Mozilla standards-positions issue URL

https://github.com/mozilla/standards-positions/issues/784

WebKit Bugzilla URL

No response

Radar URL

No response

Description

If an author chooses to disable UA transitions for a subset of navigations, they will need to use the API proposed at https://github.com/WebKit/standards-positions/issues/176 to detect whether a UA transition was executed for a navigation.

annevk commented 1 year ago

Discussing this with colleagues it seems that given we support #48 we should also be supporting this, i.e., "position: support". Please say something within a week if you disagree!

khushalsagar commented 1 year ago

@annevk apologies for not updating this issue. We're not pursuing an API which lets developers disable browser UX based on your feedback at the HTML WG discussion, TAG and discussing a related issue in the context of cross-document transitions at CSSWG here.

The summary for recommendation to browsers/developers is:

If the above sounds good to you, feel free to close this issue.

annevk commented 1 year ago

I guess it's not clear to me how the browser would know for a same-document navigation that there's a developer-provided transition?

I thought this was a proposal to disable that such that you can provide your own transition using view transitions.

khushalsagar commented 1 year ago

I thought this was a proposal to disable that such that you can provide your own transition using view transitions.

Yes, the goal of this proposal was to disable the UA transition such that the author can provide their own transition. It doesn't have to be a view transition, for same-document navigations the transition could be written using any framework or other web APIs directly.

We explored 2 API contracts:

  1. The site tells us whether it has custom transitions (what this issue is about).
  2. The browser decides between the site's custom transition and UA transition, which could depend on whether the site has a custom transition. The decision is communicated to the site using the proposal in https://github.com/WebKit/standards-positions/issues/176.

But the cases where we (Chrome) is planning to add UA transitions are limited and would currently always prefer the UA transition (see below). IIUC Safari has the same stance but correct me if I misunderstood.

So we've decided to only implement #2 for now, #1 won't change the browser decision. If we consider adding UA transitions for more cases (like link clicks) then we can revisit the API proposed in #1.


For cases where a UA transition would always be preferred. Safari right now does a transition as the user swipes so they can peek at the previous/next navigation entry before doing the navigation. If we let authors disable that then the UX would be:

That seems worse than the browser doing an animation which progresses with the user gesture. The long term thinking is to provide an API for the site to observe the gesture and make it easy to write a custom transition (with a new animation timeline + View Transition). When such an API exists, the author can tell the browser about their custom transition as a part of observing the gesture.