Re: [csswg-drafts] [css-view-transitions-2] Define navigation descriptor for @view-transition (#8783)

One thing that we'd want to resolve in with the WG is whether programmatic reloads (e.g. `location.reload()`) should be included in `auto`. As per the current spec they don't, but they're interceptable via the navigation API.

If we enable it, skipping the transition for a reload in the outgoing page is still possible, and would look like this:
```js
navigation.addEventListener("navigate", async e => {
  if (e.navigationType === "reload") {
     const sheet = new CSSStyleSheet();
     sheet.replaceSync("@view-transition { navigation: none }");
     // Note that there's no need to restore it because a `reload` cancels BFCache. 
     // If this was not a `reload` we'd have to remove the sheet from the adopted stylesheets on `pagehide`.
     document.adoptedStyleSheets.push(sheet);  
  }
});
```





-- 
GitHub Notification of comment by noamr
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/8783#issuecomment-1883265772 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 9 January 2024 15:28:56 UTC