Re: [csswg-drafts] [css-view-transitions-2] view-transition-name determined by element (#8320)

The CSS Working Group just discussed `[css-view-transitions-2] view-transition-name determined by element `, and agreed to the following:

* `RESOLVED: Add three keywords, one for ID attribute, one for element identity, and one that does fallback between the two.`

<details><summary>The full IRC log of that discussion</summary>
&lt;TabAtkins> bramus: Right now we require a unique VT name for every element<br>
&lt;TabAtkins> bramus: A bit cumbersome for authors, if you have 40 cards on the page that participate, they each need a unique name<br>
&lt;TabAtkins> bramus: A lot of input in the thread<br>
&lt;TabAtkins> bramus: To summarize, our conclusion seems to be needing some way to auto-name the element<br>
&lt;TabAtkins> bramus: Right now, value is "auto", with details still a little uncertain<br>
&lt;TabAtkins> bramus: Two suggestions - auto uses the ID if it has one, or else generates a unique internal ident.<br>
&lt;TabAtkins> bramus: Second is to just go straight to unique internal ident<br>
&lt;TabAtkins> bramus: Reason for second path is if the author has ID on the element, like &lt;div id=hero>, it will use "hero" as its name. If someone later explicitly uses "hero" as the VT name, it'll clash<br>
&lt;TabAtkins> bramus: I think that's where we're at. In addition to "auto" only being able to generate unique ids, there's a proposal for an ident() function that can be used like ident(attr(foo)), to produce an ident from an arbitrary attribute<br>
&lt;vmpstr> q?<br>
&lt;TabAtkins> bramus: So options are "auto" tries to use ID, otherwise generates unique. Second is we just only do unique. And then for either, maybe give authors ability to take name from a different attribute.<br>
&lt;TabAtkins> khush: Elika left good points on the issue.<br>
&lt;TabAtkins> khush: I'm less a fan of deriving from ID for two reasons. One, can be a bit of a surprise if author isn't expecting the ID to be used, not obvious. Can cause unintended collisions.<br>
&lt;TabAtkins> khush: Tho talking with Vlad, if that's a showstopper we can namespace explicit vs ID-derived names.<br>
&lt;TabAtkins> khush: If we do decide on being able to use any attribute as the name, I'm more not in favor of auto doing it automatically. Author can just do it explicitly.<br>
&lt;astearns> ack fantasai<br>
&lt;TabAtkins> (Agree with that, ident() seems fine, or attr(foo ident), whatever.)<br>
&lt;TabAtkins> fantasai: The reason to have "auto" use the ID by default and fallback if needed is it allows author to rely on IDs in the markup that are already created, if that exists.<br>
&lt;TabAtkins> fantasai: If you can only do it explicitly, you have to know there is an ID on that element.<br>
&lt;TabAtkins> (I mean, `.foo[id] { v-t-name: attr(id ident); }`)<br>
&lt;TabAtkins> fantasai: LIke, as an author, you want an elment to transition, and if you have an ID it'll transition even if it's moving around the document or something.<br>
&lt;TabAtkins> fantasai: Should be something that works with a single keyword.<br>
&lt;TabAtkins> fantasai: If the element exists in both trees they probably want it to identify with itself.<br>
&lt;TabAtkins> fantasai: shoudln't make the author do additional work<br>
&lt;vmpstr> q+<br>
&lt;TabAtkins> astearns: Would it help if the attr method is invalid if the ID doesn't exist? So you can set auto on everything, and for the things you want to use an ID, use the function; it'll fallback.<br>
&lt;khush> q+<br>
&lt;TabAtkins> fantasai: So you're proposing two keywords, one that uses ID if possible with fallback to element identity, and the ohter that just uses element identity<br>
&lt;TabAtkins> fantasai: that's fine with me<br>
&lt;TabAtkins> fantasai: I just want things to work by default<br>
&lt;TabAtkins> fantasai: Matching up obvious things seems obvious<br>
&lt;astearns> ack vmpstr<br>
&lt;TabAtkins> vmpstr: I agree with the last point, not making author do extra work. I think there are edge cases that might not be common, where an element matches by ID, but the ID attr is removed - do we continue matching by identity?<br>
&lt;TabAtkins> vmpstr: I worry there's a little magic, like if you remove the element and add it back, it works *if* you had an ID on it, but not if you relied on identity.<br>
&lt;fantasai> `auto` is the keyword of magic!<br>
&lt;TabAtkins> vmpstr: Maybe that's something we can overcome with dev education<br>
&lt;bramus> q+<br>
&lt;TabAtkins> vmpstr: I think there are other things we might want to match on, like being selected<br>
&lt;TabAtkins> vmpstr: So I think having an attr is useful<br>
&lt;TabAtkins> q+<br>
&lt;astearns> ack khush<br>
&lt;TabAtkins> khush: I like the idea of two explicit keywords<br>
&lt;TabAtkins> khush: And maybe "auto" that magically chooses between the two, if it's not the initial value.<br>
&lt;TabAtkins> khush: We can make it pretty explicit int he property description<br>
&lt;TabAtkins> khush: So I'd be fine with "auto" as the name, if the behaviors were chooseable separately.<br>
&lt;TabAtkins> astearns: So you're proposing three keywords?<br>
&lt;TabAtkins> khush: The ability to draw from an attribute is somethign proposed generically<br>
&lt;astearns> ack bramus<br>
&lt;TabAtkins> khush: So three things (tho not necessarily keywords)<br>
&lt;fantasai> wfm<br>
&lt;TabAtkins> bramus: One thing for proposed ident() function, this doesn't just apply to v-t-name, but anywhere that takes an ident<br>
&lt;TabAtkins> bramus: So that's why I'm a big fan, it's not focused on only VT.<br>
&lt;astearns> ack TabAtkins<br>
&lt;fantasai> scribe+<br>
&lt;fantasai> TabAtkins: Haven't read entire thread, very long, but<br>
&lt;fantasai> TabAtkins: sounds like we want multiple strategies, and if one doesn't work, we fall back<br>
&lt;fantasai> TabAtkins: so can we do comma-separated?<br>
&lt;fantasai> TabAtkins: then we could allow future things, like use the selected thing (?)<br>
&lt;fantasai> TabAtkins: Then we can have strategies for marking and matching view transitions<br>
&lt;vmpstr> +1<br>
&lt;khush> sgtm<br>
&lt;TabAtkins> bramus: commas seem a bit weird?<br>
&lt;fantasai> bramus: commas seem a bit weird, e.g. animation-name, [missed]<br>
&lt;TabAtkins> bramus: If you do commas in animation-name, both names apply<br>
&lt;fantasai> bramus: view-transition-name: x, y<br>
&lt;fantasai> vmpstr: we could do space separated<br>
&lt;fantasai> TabAtkins: we use commas for lists of stuff, helps allow future syntax evolution<br>
&lt;fantasai> TabAtkins: problem with the counter properties because they didn't have commas<br>
&lt;fantasai> vmpstr: This isn't something we're thinking of doing today, but at some point we considered having multiple view transition names<br>
&lt;fantasai> vmpstr: so that same element can morph into multiple<br>
&lt;fantasai> vmpstr: so prefer space separation for that reason<br>
&lt;fantasai> TabAtkins: fine with that<br>
&lt;fantasai> TabAtkins: I doubt any syntax evolution here, it's just a name<br>
&lt;fantasai> TabAtkins: so fine to do space separation, I just default to commas<br>
&lt;astearns> ack fantasai<br>
&lt;TabAtkins> fantasai: I think multiple keywords are a bit more cognitive overhead if there's really only two things that are fallbacks<br>
&lt;TabAtkins> fantasai: I think having auto keyword doing that makes the most sense<br>
&lt;TabAtkins> (we've already discussed more than two behavior in this convo)<br>
&lt;TabAtkins> fantasai: So I think having just "auto" doing the two fallbacks makes the most sense. If we have more behaviors in the future we can add it<br>
&lt;TabAtkins> astearns: Tab said we already had more discssuion<br>
&lt;TabAtkins> fantasai: Like what?<br>
&lt;TabAtkins> TabAtkins: The selected element between two trees<br>
&lt;TabAtkins> vmpstr: Specifically, just some element with a particular class in both trees<br>
&lt;TabAtkins> fantasai: Isn't that what selectors are for?<br>
&lt;TabAtkins> fantasai: If you want to choose one attribute if it's .foo, another with .bar, we can do that with selectors<br>
&lt;TabAtkins> (tbf that same argument applies to ID, tho the possible common-ness of ID use is still an argument in favor)<br>
&lt;TabAtkins> astearns: If we go with "auto" for now, nothing stops us from allowing multiple fallbacks in the future<br>
&lt;TabAtkins> +1<br>
&lt;fantasai> +1<br>
&lt;khush> q+<br>
&lt;TabAtkins> astearns: So I'd like to propose we have three values - one that uses the ID, one that uses element identity, and "auto" that uses ID then falls back to identity<br>
&lt;astearns> ac khush<br>
&lt;astearns> ack khush<br>
&lt;TabAtkins> khush: For using a keyword for ID, is that something we want to do in other naming properties? Or is it VT specific?<br>
&lt;fantasai> PROPOSED: Introduce keyword for element identity, some other syntax for using the element's ID, and auto keyword that switches between the two<br>
&lt;TabAtkins> fantasai: I think that's a good question. A challenge is we have two different concepts for "id" and "identity" that's hard to distinguish in explanation.<br>
&lt;TabAtkins> fantasai: We could extend this to other properties possibly. Other properties have more referencing, might be a bit less useful.<br>
&lt;TabAtkins> fantasai: You name the thing, *and* refer to it from other elements. In that case the CSS needs to know the name anyway.<br>
&lt;khush> that's fair<br>
&lt;TabAtkins> fantasai: VT is a case where you don't need to know the name, you can reference it just via classes.<br>
&lt;TabAtkins> fantasai: If we introduce an ident() it should have its own issue<br>
&lt;TabAtkins> bramus: #9141<br>
&lt;TabAtkins> fantasai: If we do it shoudl be generic across CSS<br>
&lt;TabAtkins> vmpstr: Still just one keyword to specify? No fallback list?<br>
&lt;TabAtkins> fantasai: Yes. Three new keywords, but only use one at a time.<br>
&lt;TabAtkins> astearns: the ident() function isn't part of this issue, will be a different discussion<br>
&lt;TabAtkins> astearns: So three new keywords, use one at a time. Objections?<br>
&lt;TabAtkins> bramus: If we do ident() elsewhere, do we need the third keyword now? Will that be affected?<br>
&lt;fantasai> PROPOSED: Introduce keyword for element identity, some other syntax for using the element's ID, and auto keyword that switches between the two<br>
&lt;TabAtkins> fantasai: This'll be whatever the markup language defines as the element identifier, "id" in html<br>
&lt;flackr> q+<br>
&lt;TabAtkins> fantasai: xml:id in XML<br>
&lt;TabAtkins> flackr: The function for using element's ID, is that differetn from attr()<br>
&lt;fantasai> TabAtkins: proposal here is to have a specialized keyword that uses the ID<br>
&lt;fantasai> TabAtkins: could *also* allow the ident() function<br>
&lt;fantasai> flackr: and attr() would be a separate solution<br>
&lt;fantasai> fantasai: currently no-one implements ident-generating attr(), only string-generating attr()<br>
&lt;TabAtkins> RESOLVED: Add three keywords, one for ID attribute, one for element identity, and one that does fallback between the two.<br>
</details>


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


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

Received on Wednesday, 11 September 2024 17:00:23 UTC