Re: [csswg-drafts] [css-view-transitions-2] Declarative opt-in for cross-document navigations (#8048)

The CSS Working Group just discussed `Declarative Cross-document View Transitions`.

<details><summary>The full IRC log of that discussion</summary>
&lt;fantasai> Topic: Declarative Cross-document View Transitions<br>
&lt;fantasai> github: https://github.com/w3c/csswg-drafts/issues/8048<br>
&lt;fantasai> khush: Last time discussed lots of good feedback.<br>
&lt;fantasai> khush: main issue is figuring out declarative feedback for doing cross-document navigation transitoins<br>
&lt;fantasai> khush: Sub-cases are same-origin vs same-site navigation<br>
&lt;fantasai> khush: Same-document it's just syntactic sugar, can do via JS API in L1<br>
&lt;fantasai> khush: but nice to have<br>
&lt;fantasai> khush: First, if we go for simplest opt-in, binary yes/no allow/disallow<br>
&lt;fantasai> khush: but a bunch of cases have different parameters, and authors may want to decide opt-in based on what navigation corresponds<br>
&lt;fantasai> khush: additionally there are some parameters to decide what transition looks like<br>
&lt;fantasai> khush: i.e. what elements animate independently, or how to style the animation<br>
&lt;fantasai> khush: same-document / cross-document / same-origin / same-site<br>
&lt;fantasai> khush: You call document.startViewTransition, generally that should be op-tin<br>
&lt;fantasai> khush: but we found some cases where someone might wnat to disable transitions for prefers-reduced-motion<br>
&lt;fantasai> khush: and declarative syntax makes this easy<br>
&lt;fantasai> khush: For navigation, might want different animation depending on type of navigation<br>
&lt;fantasai> khush: e.g. forward vs back<br>
&lt;fantasai> khush: [missed]<br>
&lt;fantasai> khush: Lastly, which page are you going to.<br>
&lt;fantasai> khush: e.g. clicked item in the list, decides UI of next page, want to customize based on that<br>
&lt;fantasai> khush: From all these cases, if there are some which are mutually exclusive, only thing that needs to impact opt-in<br>
&lt;vmpstr> s/[missed]/there's also replace navigation, and push navigation/<br>
&lt;fantasai> khush: wouldn't change opt-in depending on same-document vs cross-document, don't need to change if the DOM looks the same<br>
&lt;fantasai> khush: In that case, have it be opt-in<br>
&lt;Rossen_> q?<br>
&lt;fantasai> khush: but if based on that you want to customize transition, e.g. back vs forward, change direction that content slides<br>
&lt;noamr> q+<br>
&lt;fantasai> khush: let's make that something that can be used to customize all CSS, not just this opt in<br>
&lt;fantasai> khush: I thought at first to use an @media query<br>
&lt;fantasai> khush: noam proposed using pseudo-classes instead<br>
&lt;fantasai> khush: and there's precedent for doing this with @page at-rule<br>
&lt;fantasai> khush: Right now 3 proposal<br>
&lt;fantasai> khush: 1. Use @media queries for deciding navigation back/forth/specific URL<br>
&lt;emilio> q+<br>
&lt;SebastianZ> q+<br>
&lt;fantasai> khush: also whether initiated via script, etc. All these cases are expressed as tokens in the opt-in rules<br>
&lt;fantasai> khush: @view-transition takes a parameter, 'transition-trigger', and you can specify various tokens for allowing<br>
&lt;fantasai> khush: Previously we discussed having reloads disabled by default, but with this syntax it's hard<br>
&lt;fantasai> khush: It seems to imply reload<br>
&lt;Rossen_> q?<br>
&lt;fantasai> khush: Second tries to solve that by saying that we can add another parameter to the at-rule, which is just 'reload', allow/disallow; initial value can be disallow<br>
&lt;fantasai> khush: only reason to do this is that media queries, they don't add any specificity, so can't add a UA style rule that says "don't trigger for reload"<br>
&lt;fantasai> khush: Later on, one suggestion from SebastianZ to include reload token within the 'transition-trigger' list itself<br>
&lt;TabAtkins> Wait, can't you tho? We don't need specificity, just order of appearance, right?<br>
&lt;fantasai> khush: technically not mutually exclusive, because same-origin or cross-document is [missed]<br>
&lt;TabAtkins> Ah tho if the author turned on some navigations that would override the "not on reload" rule then<br>
&lt;vmpstr> any author opt-in would override the reload "opt-out"<br>
&lt;vmpstr> yeah exactly<br>
&lt;fantasai> khush: but we're not aware of use cases where people would want to do differently for cross-document vs same-document reload<br>
&lt;fantasai> khush: Last option was using pseudo-class, use @view-transition but you can add a pseudo-class which is a mapping to the navigation type<br>
&lt;fantasai> khush: then we can add a UA style rule @view-transition :reload { [no transition] }<br>
&lt;Rossen_> q?<br>
&lt;fantasai> khush: It will have more specificity, so UA rule would win<br>
&lt;fantasai> khush: Because of that I'm liking this option the most<br>
&lt;Rossen_> ack noamr<br>
&lt;fantasai> noamr: Want to add that this conversation came from F2F where we were asked to think ahead to features we wanted in View Transitions<br>
&lt;fantasai> noamr: even though all we want to do in L2 is the simple opt-in<br>
&lt;TabAtkins> hmmm, i might suggest making the property comma-separated, one keyword per - then you can add additional features (like reload) to each iteration.<br>
&lt;fantasai> noamr: idea that we think ahead to how things look like<br>
&lt;fantasai> noamr: In all those options, the first version is very similar<br>
&lt;fantasai> noamr: where we have a view transition rule and inside of it a navigation trigger etc.<br>
&lt;TabAtkins> trans-trigger: none | [ [reload | no-reload] || &lt;transition-type> ]#<br>
&lt;Rossen_> ack emilio<br>
&lt;fantasai> emilio: I wanted to mention that media queries seem like an odd choice here<br>
&lt;fantasai> emilio: feels cleaner to just extend the rule to allow selecting the cases you want<br>
&lt;fantasai> emilio: Media queries you can do anything inside them, not just view transition rules<br>
&lt;fantasai> emilio: so unclear when that applies<br>
&lt;fantasai> emilio: do we need to do a full style update?<br>
&lt;TabAtkins> Bringing in specificity for the rule itself seems a little more complex than we need, and it seems strange to promote reload, specifically, to be the thing promoted to "selector"-ish.<br>
&lt;fantasai> emilio: so it feels like an odd choice, so if we ned to add this kind of selector capability, extending the rule itself seems better<br>
&lt;TabAtkins> q+<br>
&lt;fantasai> emilio: Other thing to mention, we have a kind of precedence for this kind of stuff with scroll-behavior<br>
&lt;fantasai> emilio: it was mentioned that what you want to do is e.g. disable imperative animations<br>
&lt;fantasai> emilio: stylesheet would override<br>
&lt;fantasai> emilio: that's not how scrollIntoView etc works<br>
&lt;fantasai> emilio: so might want to be consistent with that<br>
&lt;Rossen_> ack SebastianZ<br>
&lt;fantasai> SebastianZ: Noam pointed out important thing, this is divided into 3 pieces<br>
&lt;fantasai> SebastianZ: URL, type, and mechanism<br>
&lt;fantasai> SebastianZ: was thinking about, maybe they shouldn't be part of the prelude but rather different descriptors<br>
&lt;noamr> q+<br>
&lt;fantasai> SebastianZ: so have a descriptor for each of these pieces<br>
&lt;khush> q+<br>
&lt;fantasai> SebastianZ: so you'd have a type descriptor that takes "reload | travers | etc"<br>
&lt;fantasai> SebastianZ: a descriptor for same-origin / cross-origin<br>
&lt;fantasai> SebastianZ: and a descriptor for the mechanism itself<br>
&lt;Rossen_> ack fantasai<br>
&lt;Zakim> fantasai, you wanted to clarify that origin wins over specificity<br>
&lt;fantasai> scribe+ emilio<br>
&lt;emilio> fantasai: Wanted to point out that in the cascade, origin is more powerful than specificity<br>
&lt;emilio> ... so even if specificity of the :reload pseudo-class is higher UA origin would override<br>
&lt;emilio> ... I also want to agree with emilio wrt stashing this on a media query<br>
&lt;TabAtkins> q-<br>
&lt;TabAtkins> actually i'm gonna just take my convo to the issue<br>
&lt;emilio> ... SebastianZ's idea of encapsulating all these in descriptors makes sense, it's like @font-face<br>
&lt;emilio> ... the other thing authors might want to control is defining the type of navigation based on the URL<br>
&lt;emilio> ... and you might want to have that centralized<br>
&lt;Rossen_> q?<br>
&lt;emilio> ... that way when you need to update any of these types of navigations you don't need to go through everything<br>
&lt;fantasai> s/everything/everything to update the URL list everywhere/<br>
&lt;fantasai> ... I think it would be useful to style based on the class of view transition (author-defined class)<br>
&lt;fantasai> noamr: Idea of having descriptor for transition class or group, equivalent to how we would do it in SDA, like a parameter to .startViewTransition<br>
&lt;emilio> s/SDA/SPA<br>
&lt;fantasai> noamr: in this case, we can't have other descriptors for URL origin for navigation type<br>
&lt;fantasai> noamr: because they would interfere with each other<br>
&lt;fantasai> noamr: that's why I want outside the braces, as part of pseudo-classes<br>
&lt;fantasai> noamr: If this is a back navigation, use this transition<br>
&lt;fantasai> noamr: if it is a ???, then don't allow cross-origin<br>
&lt;fantasai> noamr: It needs to be outside so we can style navigations based on it<br>
&lt;fantasai> noamr: so what's outside is the navigation type and origin, and inside is only the mechanism<br>
&lt;fantasai> noamr: something that shouldn't affect the styling, but only be a trigger boolean opt in<br>
&lt;Rossen_> ack noamr<br>
&lt;Rossen_> ack khush<br>
&lt;fantasai> khush: Question for fantasai and emilio<br>
&lt;fantasai> khush: You mentioned you don't like idea of media query or pseudo-class<br>
&lt;fantasai> khush: but if I want to add a view transition class name based on what type of transition it is<br>
&lt;fantasai> khush: how would I go about doing that?<br>
&lt;fantasai> khush: either can specify any CSS rule, or ...<br>
&lt;fantasai> khush: any suggestion other than MQ or pseudo-class? How would they specify different `view-transition-name`?<br>
&lt;fantasai> &lt;fantasai> Good question... I don't have a good answer.<br>
&lt;fantasai> Rossen_: Doesn't seem we're ready for resolution, but getting some sense of direction<br>
&lt;fantasai> Rossen_: Seems like it should continue in the issue<br>
&lt;fantasai> khush: Can take to issue<br>
&lt;fantasai> khush: What I'm stuck on is what CSS concept to use on customization<br>
&lt;fantasai> khush: If someone could put some thoughts, that would help move the issue forward<br>
&lt;khush> Thank you!<br>
</details>


-- 
GitHub Notification of comment by css-meeting-bot
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/8048#issuecomment-1671755964 using your GitHub account


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

Received on Wednesday, 9 August 2023 16:28:02 UTC