-
Notifications
You must be signed in to change notification settings - Fork 693
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[css-view-transitions-2] Feature detection for VT cross-document #9891
Comments
There's multiple ways to detect this in JS. For example, whether CSSOM has the viewTransition rule. And the CSS detection can use |
Is this working? As I'm on Chrome 126 version which supports MPA but still
giving me |
I'm happily proven wrong but I don't think that's currently possible, because the resolution of #2463 (comment) still didn't make it into the spec. and much less into browsers. With that, support checking general support for @supports at-rule(@view-transition) {
…
} Analogous, in JS this would look like this: if (CSS.supports('at-rule(@view-transition)') {
…
} or by checking for the if (CSSViewTransitionRule) {
…
} Sebastian |
Thanks for bringing this up Suraj. The chromium bug for this feature is here. Please +1 to bump it on the priority list. In the meantime, there's a couple of ways that should work.
:root:active-view-transition #foo {
view-transition-name: foo;
}
/* or */
@view-transition {
navigation: auto;
types: navigation;
}
:root:active-view-transition(navigation) #foo {
view-transition-name: foo;
}
let supportsCrossDocVt = typeof PageSwapEvent != "undefined" && Object.hasOwn(PageSwapEvent.prototype, 'viewTransition'); Would these suffice? If not, please let me know the use-case and I'll try to see if there's a better suggestion. |
Authors need to be able to detect support for cross-document ViewTransitions, both in CSS and JS. In JS, there's a few options like whether there is
viewTransition
attribute onpageconceal
/pagereveal
events. AlsoCSS.supports(@view-transition)
to check if the at-rule is valid CSS syntax.For CSS, this can be checked with
@supports(@view-transition)
but its unclear whether that's enough oractive-view-transition
should be the recommendation. Since that tells you whether there is a transition in progress right now as opposed to whether the feature is supported by the browser.The text was updated successfully, but these errors were encountered: