Open khushalsagar opened 1 year ago
I think reloads should not be supported. Reload is about starting the page from scratch, it kind of goes against the concept of transitions.
To disable same-page transitions on reload, you can use JS in the head (it's a bit hacky but should give a direction):
if (performance.getEntriesByType("navigation")[0].type ==="reload") {
document.documentElement.dataset.reload = true;
}
window.onload = () => {
document.documentElement.dataset.reload = false;
}
html[data-reload]::view-transitions {
display: none;
}
See more comprehensive example of how to do this in userland: https://github.com/w3c/csswg-drafts/issues/8685#issuecomment-1568164673
The questions to resolve here are:
Should reloads be supported for View Transitions at all? We can technically do it but it's unclear if this is what authors want. We've heard from authors which were surprised by them (when trying out the prototype in Chromium) and wanted to disable it. But haven't heard from anyone who wants that capability.
If we do want transitions on reloads but authors should be able to configure them, do they happen by default or not. There is already going to be an opt-in for cross-document View Transitions. It's unclear if this global opt-in enables transitions on all navigation types. Or whether it enables them for every navigation type other than reload and an additional opt-in is required for reloads.
The CSS Working Group just discussed [css-view-transitions-2] Should ViewTransitions be triggered for reloads?
, and agreed to the following:
RESOLVED: Reloads don't trigger view transitions by default.
This is now for adding a reload keyword eventually.
A reload is technically a cross-document same-origin navigation, but its unclear whether authors want a ViewTransition in such cases. One of the sites we're working with mentioned they don't want any animation on reloads.
Note that since the UA CSS does a cross-fade between root images using plus-lighter, that animation is a no-op if there is no change in visual content. But if the site overrides this for a different default (like a slide), they'll need to detect reloads to get back the no-op cross-fade.
We can make this configurable so the author can decide whether reloads from the current Document trigger a ViewTransition.