Re: [csswg-drafts] [css-view-transitions-2] Syntax for customizing transitions based on their type (#8960)

The CSS Working Group just discussed `[css-view-transitions-2] Syntax for customizing transitions based on their type`, and agreed to the following:

* `RESOLVED: Add a 'TBD' argument to startViewTransition that takes a list of CSS identifiers, allow them to match against a pseudo-class which accepts a comma-separated (or) list of view transition names during which it matches`

<details><summary>The full IRC log of that discussion</summary>
&lt;noamr> Summary: https://github.com/w3c/csswg-drafts/issues/8960#issuecomment-1708702647<br>
&lt;TabAtkins> noamr: I posted a summary content for where we've gotten to and what the proposal is<br>
&lt;TabAtkins> noamr: We also gave a summary in general of VT yesterday<br>
&lt;TabAtkins> noamr: This is a continuation from the f2f a few months ago<br>
&lt;TabAtkins> noamr: With a single document with many VTs possible - think of a spotify that can slide-transition between main pages, and a different between a played song where it expands<br>
&lt;TabAtkins> noamr: So we want a way to say "don't take everything from the page that can transition", but rather name the type of transition and pick and choose which elements go with what<br>
&lt;TabAtkins> noamr: So far the way to do it is modifying the DOM: put a class on &lt;html> that you use in a selector to set v-t-name<br>
&lt;TabAtkins> noamr: Some issues, using DOM as ephemeral state for something that's entirely style<br>
&lt;TabAtkins> noamr: Plus when we go later in cross-document, we want a declarative way to do this<br>
&lt;TabAtkins> noamr: So we want a notion of cross-frame transitions that's embedded into CSS rather than a general-purpose JS mechanism.<br>
&lt;TabAtkins> noamr: Proposed syntax is something that looks and feels like class names<br>
&lt;TabAtkins> noamr: We'd pass it together with the v-t<br>
&lt;TabAtkins> noamr: Currently it only accepts one parameter, the update callback<br>
&lt;TabAtkins> noamr: We suggest another parameter, a list of a transition types<br>
&lt;TabAtkins> noamr: like "slide" or "reverse-slide", etc<br>
&lt;TabAtkins> noamr: And then have a pseudo-class on whatever's scoping the transition (currently, always &lt;html>), and that matches based on which transition types are activated<br>
&lt;TabAtkins> noamr: I want to present the alternative we consdiered, too<br>
&lt;TabAtkins> noamr: Which was to qualify the pseudo-elements that are created<br>
&lt;TabAtkins> noamr: We thought that wasn't enough, since the transition type also affects which elements are picked for the transition, not just which pseudo-elements are created.<br>
&lt;TabAtkins> noamr: The more advanced alternative is we qualify pseudo-element names too.<br>
&lt;TabAtkins> noamr: That's possible, but felt limiting.<br>
&lt;TabAtkins> noamr: Perhaps you want to hide something in the page while the transition is going on, it' snot necessarily participating in the transition.<br>
&lt;vmpstr> q?<br>
&lt;TabAtkins> noamr: So we felt there's not much reason to avoid our preferred solution, and the other ways are all limited.<br>
&lt;TabAtkins> +1, this sounds good<br>
&lt;vmpstr> TabAtkins: i like this idea, and sounds reasonable. official cases brought up with things that don't participate makes sense<br>
&lt;khush> q+<br>
&lt;astearns> ack khush<br>
&lt;TabAtkins> khush: I prefer "type" over class names<br>
&lt;fantasai> +1<br>
&lt;noamr> q+<br>
&lt;TabAtkins> khush: because there's another feature request where people want to apply styles to some pseudos<br>
&lt;TabAtkins> khush: right now you can either do all ::v-t-group() or one with a particular name, can't do just some in a group<br>
&lt;vmpstr> q+<br>
&lt;TabAtkins> khush: Second is "and" vs "or"<br>
&lt;TabAtkins> khush: keeping the same syntax as proposed here seems good<br>
&lt;astearns> ack fantasai<br>
&lt;TabAtkins> fantasai: I agree with khushal that using classes seems tied into html classes, seems confusing. "type" seems fine.<br>
&lt;eeeps> lea: https://github.com/w3c/csswg-drafts/issues/8960<br>
&lt;TabAtkins> fantasai: Another q, when you specify multiple names in the pseudo-class, is that "and" or "or". If it's "or" you should use a comma.<br>
&lt;TabAtkins> fantasai: Overall a good approach.<br>
&lt;astearns> ack noamr<br>
&lt;TabAtkins> noamr: I thought "types" were a bit [missed], it describes something nominal<br>
&lt;TabAtkins> noamr: But im' fine with that<br>
&lt;TabAtkins> noamr: For "and" vs "or", we thought of spaces meanin "and" and commas meaning "or"<br>
&lt;khush> sounds good<br>
&lt;fantasai> +!<br>
&lt;fantasai> s/!/1/<br>
&lt;TabAtkins> TabAtkins: Other option is we just do neither and rely on selector syntax to handle and/or<br>
&lt;TabAtkins> TabAtkins: Depends on how common we think selecting on multiple names will be<br>
&lt;ydaniv> q+<br>
&lt;TabAtkins> astearns: That would also be more compatible with future development<br>
&lt;TabAtkins> noamr: Yeah, that's a possibility<br>
&lt;TabAtkins> vmpstr: Comment about the name<br>
&lt;fantasai> ... It's a reallllly long pseudo-class name, let's not make people type out that much for simple booleans :)<br>
&lt;TabAtkins> vmpstr: I prefer "class" over "type" specifically because I think there's a possibility of using this in other contexts like web animations<br>
&lt;astearns> could think of and/or as a future extension to solve that pain :)<br>
&lt;TabAtkins> vmpstr: This would be able to set a number of additional classes that last for some duration<br>
&lt;TabAtkins> vmpstr: In this case the pseudo-class name would have to be in there, so it's not tied to VT<br>
&lt;TabAtkins> vmpstr: But if it's specifically "class"... I'm not particularly tied to it but it invokes CSS classes which is what this acts like.<br>
&lt;fantasai> TabAtkins: This is basically an automatically-managed class<br>
&lt;fantasai> TabAtkins: browser is adding/removing for you<br>
&lt;astearns> ack ydaniv<br>
&lt;astearns> ack vmpstr<br>
&lt;TabAtkins> YehonatanDaniv: The direction is good, if we had a list of types/classes/whatever, I think doing "and" would be more productive<br>
&lt;TabAtkins> YehonatanDaniv: But in general having a list of types, this covers the need<br>
&lt;TabAtkins> astearns: I had an instinctual yuck against using space/comma to indicate and/or<br>
&lt;TabAtkins> astearns: Any strong reason to not use `and` and `or` keywords?<br>
&lt;TabAtkins> noamr: No particular reason, jsut consistency with selectors. But that would be consistent with MQs, so.<br>
&lt;TabAtkins> noamr: Another idea was to borrow the class selector syntax, so `.page.slide, .foo-slide`<br>
&lt;TabAtkins> astearns: How much do you think we can resolve on today?<br>
&lt;hober> q?<br>
&lt;TabAtkins> noamr: I'd like to say that we'll decide on the name and the and/or syntax later, but the general idea is good.<br>
&lt;fantasai> We use commas to mean "or" in several places in functional pseudo-class syntax<br>
&lt;TabAtkins> astearns: I'd like to add a specific syntax in the spec if possible<br>
&lt;TabAtkins> astearns: If people have concerns about what we chose, they can raise issues.<br>
&lt;TabAtkins> noamr: I suggest to resolve for now on "type" and not having and/or syntax yet<br>
&lt;TabAtkins> noamr: Since selectors can already do and/or for now.<br>
&lt;TabAtkins> khush: If we resolve on this now, will this break if someone makes a VT type named "and"?<br>
&lt;TabAtkins> TabAtkins: No, since we'll currently be allowing only one name. In the future if we allow and/or internally, it'll be written ":v-t-type(and and foo)`, which is perfectly unambiguous (to a machine)<br>
&lt;ydaniv> q+<br>
&lt;TabAtkins> fantasai: we use commas all over selector syntax to mean "or"<br>
&lt;noamr> +1<br>
&lt;TabAtkins> fantasai: So even if we decide to add boolean keywords later, we'd probably still want commas for consistency with tons of things<br>
&lt;TabAtkins> fantasai: So I think we should adopt that in the first iteration as well<br>
&lt;astearns> ack fantasai<br>
&lt;TabAtkins> +1, it is very natural<br>
&lt;astearns> ack ydaniv<br>
&lt;TabAtkins> and the "and" selector behavior is shorter<br>
&lt;TabAtkins> YehonatanDaniv: So if I get this right, I can specify a few tpes in the startViewTransition() call<br>
&lt;fantasai> TabAtkins: They'll all apply<br>
&lt;TabAtkins> noamr: So elika do you want space for "and"?<br>
&lt;TabAtkins> fantasai: I'm fine with that, I mainly just care about commas for "or"<br>
&lt;fantasai> TabAtkins: and might inhibit future syntax design<br>
&lt;fantasai> s/and might/"and" might/<br>
&lt;TabAtkins> astearns: So it sounds like we have consensus on adding a list of types to VT<br>
&lt;TabAtkins> khush: yes<br>
&lt;TabAtkins> astearns: and add exapmles for referring to them<br>
&lt;TabAtkins> astearns: Objections to list of types?<br>
&lt;TabAtkins> vmpstr: Are we specifically calling these "types"?<br>
&lt;TabAtkins> fantasai: For the argument we can say "names", editorially we can call them type names or class names or wahtever.<br>
&lt;TabAtkins> noamr: Yeah because the name wouldn't occur in CSS<br>
&lt;noamr> we use the word "names" as the parameter name in CSS, and that word does not appear in CSS<br>
&lt;noamr> sorry, we use the word "names" as the parameter name in JS, and that word does not appear in CSS<br>
&lt;TabAtkins> s/name in CSS/name in JS/<br>
&lt;fantasai> PROPOSED: Add a 'names' argument to startViewTransition that takes a list of CSS identifiers, allow them to match against a pseudo-class which accepts a comma-separated (or) list of view transition names to match<br>
&lt;fantasai> s/to match/during which it matches/<br>
&lt;TabAtkins> vmpstr: So clarifying the syntax, there's a distinction between adding the second param to sVT(), which is different from Noam's comment that has a dict<br>
&lt;TabAtkins> noamr: We'r enot proposing a second param, we want sVT() to accept *either* a callback or an options bag<br>
&lt;TabAtkins> The options will be a callback and the names<br>
&lt;TabAtkins> dbaron: Is there a reason not to do a callback followed by an options bag?<br>
&lt;TabAtkins> noamr: This is an API design more from Jake; we don't think the update callback is the obvious first param, it was just the only one earlier.<br>
&lt;TabAtkins> dbaron: That makes sense.<br>
&lt;TabAtkins> zcorpan: Slight concern with "names" as the name. We already have view-transition-name<br>
&lt;fantasai> that's a good point<br>
&lt;TabAtkins> TabAtkins: I propose that we resolve on the name of the option in two weeks, when we next meet<br>
&lt;fantasai> PROPOSED: Add a 'TBD' argument to startViewTransition that takes a list of CSS identifiers, allow them to match against a pseudo-class which accepts a comma-separated (or) list of view transition names during which it matches<br>
&lt;TabAtkins> TabAtkins: What's the pseudoclass called?<br>
&lt;fantasai> RESOLVED: Add a 'TBD' argument to startViewTransition that takes a list of CSS identifiers, allow them to match against a pseudo-class which accepts a comma-separated (or) list of view transition names during which it matches<br>
&lt;TabAtkins> noamr: :active-view-transition()<br>
&lt;noamr> https://github.com/w3c/csswg-drafts/issues/8048<br>
&lt;TabAtkins> noamr: And we wait for "and" semantic later if needed<br>
</details>


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


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

Received on Thursday, 14 September 2023 15:39:18 UTC