-
Notifications
You must be signed in to change notification settings - Fork 677
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] Allow an auto-generated view-transition-name
that doesn't default to ID
#10995
Comments
Copying over my comment from 8320 for visibility:
|
Any thoughts on |
Not a big fan of it, but also not against it. I recently read up on This give me a new idea (which would alter the resolution from #8320): what if there was a function that allowed authors to list certain options and it returns the first non empty one?
That would prevent a lot of confusion on the author side, as Otoh it would require a little more typing if they want the fallback behavior, but it would also allow authors to add more options to the fallback: e.g. |
To me this feels too verbose for a feature that's supposed to be a DX convenience... I think once I think the direction the |
True. Other possible keyword values I can think of, as an alternative to
I think both clear convey that a value is automatically generated. (Curious to know if @nt1m or @fantasai have suggestions or a preference here) |
Fwiw, the same feature in the |
I like |
We don't really need |
Looking at the results of these polls:
There is clear mismatch between how authors interpret the keywords and what is currently resolved on and/or proposed within the working group. Authors don’t interpret
Two people shared loose replies that suggested the keyword
I kinda forgot that Winging back tot he naming/keywords aspect: can we meet authors here? Strawperson suggestion:
This matches with how they interpret things. |
I disagree with this. The I'm personally not sure we need something like |
For today’s breakout session, I think there are two paths forward:
Things to consider:
Something that just came to mind: the keyword that covers the “automatically generate me a name” case can potentially be reused in the |
Agree with @nt1m here, and I think the Twitter poll was not worded in a way to answer the question of “is our current definition for |
The CSS Working Group just discussed
The full IRC log of that discussion<fantasai> bramus: This issue is about allowing an auto view-transition-name to be generated by specifying a keyword<fantasai> bramus: a number of keywords suggested, from-element, per-element, self, auto, auto-id <fantasai> bramus: I asked authors "which keyword conveys using ID and falling back to auto-generated" and "which keyword conveys automatically generated" <fantasai> bramus: when I asked which is "automatically generated", they picked "auto" <fantasai> bramus: when I asked about the ID and fallback, the responses ... <fantasai> bramus: We were thinking 'from-element' but authors expected 'auto' for "automatically generated". <fantasai> bramus: we could meet developers by reverting previous resolution about auto reading ID and falling back <fantasai> bramus: and come up with a better keyword <fantasai> bramus: or push authors towards using attr() function which is suited for this, can use attr(id, auto) for fallback behavior <fantasai> bramus: or keep previous resolution of using auto for fallback behavior, but then we need to come up with a very good keyword for the autogeneration <fantasai> bramus: Authors prefer auto-id for autogenerated, and some suggested generated <fantasai> bramus: and some others said, don't we have attr() for this? <bramus> fantasai: we can conclude from the poll that there is cnofusion over keywords <bramus> … wording of poll most likely prompted some of the responses <bramus> … using “automatically generated id” pushed authors towards `auto` <bramus> … internally we are generating one, bu thtat is just the meachism <bramus> … it is an internal detail <bramus> … the will never see it … we might not even generate one and use poitner identity <bramus> … its not about automatically generating ids, its about the identify of the element object <bramus> … poll is propably a but confused on that point <bramus> … could try to come up with good keywords but maybe need some more ideas <bramus> … but doesnt mean that we should revert decision on `auto` <bramus> … in terms of possible keywords: `mathc-elememtn` is an option as we use match in a few other places <bramus> … but open to ideas <astearns> q+ <bramus> … at webkit we think `auto` is the right way to define it <khush> q+ <astearns> ack fantasai <bramus> … and maybe need other keyword for the other thing <noamr> I like match-element <bramus> astearns: the currently specced behavior for auto is to use the id attr and fall back to auto generated one? <bramus> fantasai: its to use the identity of the element <bramus> … if there is no id, we look at the element being the same object or not <bramus> … in that case, the object hasnt been destroyed - its a singular one that you can map between tree versions <astearns> ack astearns <astearns> ack khush <bramus> khush: spec might say to generate one, but conceptually get the point that that is one way to implement it. you don”t need strings to establish identity <bramus> … of all options maybe self is nice as it doesnt hit at generating something <florian> q+ <bramus> … your identtity is the nodes identity <bramus> … auto is confusing. kind of a grab value in css to figure out automatically what to do which is what we doing here as well <astearns> ack florian <fantasai> match-element? same-element? <bramus> florian: explanation fantasai just gave: if that can be used. key point is stability … so maybe akeyword like stable? <bramus> … if the elemen tis still around it will be the same <noamr> q+ <bramus> … dont describe what we do but the why <astearns> ack noamr <bramus> noamr: I like match-element. we match not just the id, but the actual elements <bramus> … matching two state of the same element <bramus> q+ <khush> i'm ok with match-node or match-element <fantasai> bramus: I like all these suggestions just now, `stable` and `match-element`. <fantasai> bramus: doesn't seem confusing <astearns> ack bramus <fantasai> bramus: `from-element` implies reading from the element, but matching is matching so seems like a good suggestion <fantasai> bramus: wrt `auto` part, as DevRel we can hammer on this point, means "try to get a name" not "automatically generate one" <fantasai> astearns: which method do we expect authors to use most? <fantasai> noamr: It depends <fantasai> noamr: Likely use explicit names. Otherwise likely to use auto, it will just work. <fantasai> noamr: But if they want to specifically say that id attrs don't participate, then use match-element <fantasai> noamr: I think auto would be more common, it will usually just work. <fantasai> noamr: element identity, not observable if generated string <fantasai> astearns: We have a way of using the ID attribute, specifically, by using attr() function <fantasai> astearns: we have defined `auto` to match the element by ID if there is one, or using other methods if not <fantasai> astearns: Is there really a use case for "throw out the IDs and only use the opaque element-matching algorithm" ? <fantasai> khush: Point came up last time, if these are only two (auto and attr(id)), then there's no way to say "I want to match based on element identity even though I put an ID on it" <fantasai> noamr: You wouldn't be able to match if element has an ID in only one of the state <fantasai> khush: or if ID is used for a different reason, and not used in view transitions <fantasai> astearns: I can see the case, but not expecting authors to run into it much <fantasai> noamr: cleaner solution to have specific keywords for each behavior <fantasai> astearns: understand, but that's a theoretical purity argument <fantasai> khush: We heard from one [missed] <astearns> ack fantasai <bramus> fantasai: in terms of the name clashing we might want to consider namespacing ids taken from the element vs names that we put direclty into css <astearns> s/[missed]/AirBnB where teams use ids for entirely different things <bramus> … that would avoid name clasing <bramus> … already have pseudo selelcting syntax but are not using the ! sign for keywords. Could say tha ti fyou pull the id from the attr, then it gets prefixed with the ! sign in the matching. <noamr> q+ <bramus> … that would namespace it and avoid clashes <fantasai> s/!/#/g <bramus> astearns: this would be an additional thing <bramus> fantasai: would mean for auto and I guess attr() tha twe are generating the namemt hen you would use v-t-g(#id) to select and style it <bramus> q+ <bramus> khush: not sure about this, but maybe could do it for auto-generated ones. Not for those read from attr. <bramus> … will be a pain to keep track of where it came fromg <bramus> fantasai: fair <astearns> ack noamr <bramus> noamr: against namespacing because of flexibility of VTs. <bramus> … take cross-doc VT with #hero id on one side and one with hero v-t-name on other side <bramus> … would want to transition between those <bramus> khush: can open issue separately from this <astearns> ack bramus <fantasai> bramus: Just realized, we could not tackle this problem as part of view transitions, keep auto as it is, and look at the ident() function and allow it to take a keyword <fantasai> bramus: so if you want to auto-generate an ident you use it <bramus> fantasai: so ident() should take wjhat? <bramus> bramus: `view-transition-name: ident(auto)` to auto-generate an ident <bramus> … so we dont have to come up with a keyword for this <bramus> fantasai: but that retrurns an actual observable identifier <bramus> … which we dont think we want to do <bramus> … should still have keyword for it <noamr> q+ <bramus> … can consider is distinguishing between auto keyword actually creating a referencable v-t-n or just an internal matching <bramus> … can you selec tagainst the generated identifier is an open question <bramus> … would we do that or just use the id attr to match elements but not to select against it <bramus> … like `::v-t-g(id)` <bramus> khush: would be nice if you could do it for for the `[id]` case <bramus> … pretty convenient <bramus> fantasai: only downside is that we might have namespace clashes and stuff that you are using for identity in the document <bramus> noamr: right, mixing things <bramus> fantasai: can agree on keeping `auto` as it is <bramus> … and for now add a keyword `match-element` for only looking at element id <bramus> … and open issue to mix the namespaces <noamr> q- <fantasai> s/to mix/about mixing/ <bramus> astearns: Gonna need async resolution as we are low on people attending <bramus> PROPOSED RESOLUTION: Add `match-element` keyword that will only use element identity and not use id attributes. <bramus> astearns: will be submitted as an async resolution <fantasai> RESOLVED: [Pending async confirmation] `auto` will match elements using their ID attributes, falling back to element identity; `match-element` will only use element identity. |
https://bugs.webkit.org/show_bug.cgi?id=282344 rdar://138932551 Reviewed by NOBODY (OOPS!). See w3c/csswg-drafts#10995 * LayoutTests/imported/w3c/web-platform-tests/css/css-view-transitions/match-element-name-expected.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-view-transitions/match-element-name-ref.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-view-transitions/match-element-name.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-view-transitions/parsing/view-transition-name-valid-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-view-transitions/parsing/view-transition-name-valid.html: * Source/WebCore/css/CSSProperties.json: * Source/WebCore/css/CSSValueKeywords.in: * Source/WebCore/dom/ViewTransition.cpp: (WebCore::effectiveViewTransitionName): * Source/WebCore/rendering/style/ViewTransitionName.h: (WebCore::Style::ViewTransitionName::createWithMatchElement): (WebCore::Style::ViewTransitionName::isMatchElement const): (WebCore::Style::operator<<): * Source/WebCore/style/StyleBuilderConverter.h: (WebCore::Style::BuilderConverter::convertViewTransitionName):
https://bugs.webkit.org/show_bug.cgi?id=282344 rdar://138932551 Reviewed by NOBODY (OOPS!). See w3c/csswg-drafts#10995 * LayoutTests/imported/w3c/web-platform-tests/css/css-view-transitions/match-element-name-expected.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-view-transitions/match-element-name-ref.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-view-transitions/match-element-name.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-view-transitions/parsing/view-transition-name-valid-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-view-transitions/parsing/view-transition-name-valid.html: * Source/WebCore/css/CSSProperties.json: * Source/WebCore/css/CSSValueKeywords.in: * Source/WebCore/dom/ViewTransition.cpp: (WebCore::effectiveViewTransitionName): * Source/WebCore/rendering/style/ViewTransitionName.h: (WebCore::Style::ViewTransitionName::createWithMatchElement): (WebCore::Style::ViewTransitionName::isMatchElement const): (WebCore::Style::operator<<): * Source/WebCore/style/StyleBuilderConverter.h: (WebCore::Style::BuilderConverter::convertViewTransitionName):
https://bugs.webkit.org/show_bug.cgi?id=282344 rdar://138932551 Reviewed by NOBODY (OOPS!). See w3c/csswg-drafts#10995 * LayoutTests/imported/w3c/web-platform-tests/css/css-view-transitions/match-element-name-expected.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-view-transitions/match-element-name.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-view-transitions/parsing/view-transition-name-valid-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-view-transitions/parsing/view-transition-name-valid.html: * Source/WebCore/css/CSSProperties.json: * Source/WebCore/css/CSSValueKeywords.in: * Source/WebCore/dom/ViewTransition.cpp: (WebCore::effectiveViewTransitionName): * Source/WebCore/rendering/style/ViewTransitionName.h: (WebCore::Style::ViewTransitionName::createWithMatchElement): (WebCore::Style::ViewTransitionName::isMatchElement const): (WebCore::Style::ViewTransitionName::scopeOrdinal const): (WebCore::Style::operator<<): * Source/WebCore/style/StyleBuilderConverter.h: (WebCore::Style::BuilderConverter::convertViewTransitionName):
The CSSWG will automatically accept this resolution one week from now if no objections are raised here. Anyone can add an emoji to this comment to express support. If you do not support this resolution, please add a new comment. Proposed Resolution: |
I strongly feel the current direction is a mistake.
I understand where this is coming from, but I don't think 'some completely different behaviour' is at all sensible. The behaviour is only the same between same & cross-document transitions if every element has an Given this, having two features:
…seems much more sensible and easier to understand. The first feature will behave consistently between same & cross-document transitions. The second won't work cross-document at all, but it's easy to understand why - the nodes are different. By smashing them into one feature, instead of having one feature that consistently works cross-document, and one that consistently doesn't work cross-document, we're ending up with one feature that doesn't behave consistently. Even worse, parts of the transition might kinda work, depending on which elements have IDs, and it's going to be hard for developers to figure out why Even if you learn that " Given how different these features are, as I developer I want to pick between them. I don't want the UA picking for me. I don't want removing an |
These two features you mention already exist:
|
My point is that it isn't doing the right thing, it's obfuscating doing an unreliable thing. If I want the thing to work for both SPA and MPA, then I'll use If I only want the thing to work SPA, then I guess it's interesting that The good thing about |
There is a good reason to do so, JS based apps can attach whatever view-transition-name they want programmatically via script. If the person is using a JS framework, there's a great chance that will be abstracted away anyway.
I do think it is useful having an |
When is the call? Is there a special call for this or is it Wednesday's meeting? |
It's up to the chairs, I'll ask for it to be prioritized for this Wednesday but it depends on other issues etc. |
Proposing to have a time-boxed discussion and optionally resolve based on this comment - remove As there is no current consensus on the ID behavior of |
I might not make the call, but I want to strongly support the resolution @noamr is proposing. The current view transition tools support 'page' transitions, not inner component transitions. At Shopify, we recently abandoned view transitions for some "list reordering" transitions because other UI had to become inert during the transition. Scoped view transitions are the solution here, but we're not at that stage. It feels like folks are being guided by a few codepen demos that don't actually work in practice, although they make me excited about what we could do in future with scoped transitions.
Using an ID as the View transition CSS behaviour should be as similar as possible between same-document and cross-document transitions. Some folks don't see that as an acceptable design goal. I strongly disagree. Arbitrary behaviour differences make systems difficult to learn. I don't see why we'd put that on developers without good reason. I don't see a good reason here. We could look at different defaults for scoped transitions if they make sense. The proposed behaviour of I'm not against at some point having a "it's what you want most of the time" |
The CSS Working Group just discussed The full IRC log of that discussion<TabAtkins> noamr: there was a resolution previously for the behavior of "auto"<TabAtkins> noamr: where it goes to the ID as a name, then falls back to element-identity <TabAtkins> noamr: Jake raised some good points <TabAtkins> noamr: myself and a few other googlers consulted as well <TabAtkins> noamr: we feel like there's no current good proposal for "auto". we're not against doing something with the word "auto" in the future, but we're not suggesting anything else for "auto" right now. <TabAtkins> noamr: so our suggestion is to remove "auto" from the spec for now. Leave "match-element" <TabAtkins> noamr: then get community feedback, and perhaps redo auto in the future <TabAtkins> noamr: we'll keep "auto" as an invalid name, so we can use it in the future <astearns> ack fantasai <JakeA> q+ <TabAtkins> fantasai: our position is we think the current definition provides a useful beahvior to authors <TabAtkins> fantasai: it does something which is "hey, try to figure out the mapping before and after" <TabAtkins> fantasai: in the most obvious way <TabAtkins> fantasai: two obvious ways are, does it match IDs, and is it the same element? <TabAtkins> fantasai: with ID being more explicit of a signal, so it wins <TabAtkins> fantasai: I think the polls about "what auto does" mixes up with a concpet of auto-generated string <bramus> q+ <TabAtkins> fantasai: if you think about identity about a string, auto could be thought of as genning such a string <TabAtkins> fantasai: but that's not what "auto" usually means in CSS. <TabAtkins> fantasai: here it's just "if there's some reasoanble auto notion of matching, use that" <TabAtkins> fantasai: and this lets us use the same view transition for a bunch of elements without ahvin to name them individuall <TabAtkins> astearns: so would you object to removing auto for now? <TabAtkins> fantasai: yes <astearns> ack JakeA <TabAtkins> JakeA: match-element, I think people think it's more useful than it actually is <TabAtkins> JakeA: if you think fo them as page transitions, that's what they're for right now... <noamr> sorry, I have to go. I think this is going beyond the scope of the time-boxed discussion <TabAtkins> JakeA: they don't work in pratice, because parts of the UI get... <TabAtkins> JakeA: we had an overlay in the list we reordered, we ahd to put that int he VT as well, but because it becomes inert that didn't work for us <TabAtkins> JakeA: we need scoped VTs for reordering <TabAtkins> astearns: noam had to leave and we're at timebox - i think i'll cut you off and we'll move on <TabAtkins> bramus: i'll defer to the issue as well <TabAtkins> astearns: so take this back to the issue. It wasn't a quick discussion, we'll bring it up again. |
Going back further into the discussion, I’d like to bring back the idea of using attr() fallback for the proposed Perhaps we have just these three options?
|
Note with (2), that I'm personally in favor of (3), OK with (2), and opposing 1 (in its current form). |
Not speccing (Originally, I had envisioned that the keyword |
To be clear, I'm happy with spec'ing and shipping I wonder though if in the future we'd want something like the |
+1 on making the values generated by
The solution here would be the proposed |
If But wouldn’t this just be a fallback to a keyword, the same as saying |
Yea I can get behind that. |
I'm not against Being able to use an attribute as the view transition name is interesting, and I'm not against that functionality being added. I have some worry that people will do something like: .some-container * {
view-transition-name: attr(id, none);
} …resulting in weird changes to transitions as folks add/remove IDs from elements for purposes other than view transitions. I also worry about what happens if the ID value is "none", "auto", "initial" etc etc. But at least they're somewhat clearly opting into that behaviour. If I saw a PR with the above, I'd reject it, and ask it to instead use an attribute like
I think the group should avoid introducing 'quirksmode' like switches in behaviour between same-document and cross-document transitions. That's part of the problem with I think those pushing for this combined |
@nt1m @fantasai do you object to resolving on |
This is fine; (Tho, unless we specify that strings are allowed in 'view-transition-name', you'll have to spell it |
Sounds good @tabatkins. As per previous comment, I'm happy to resolve on |
I'd like to hear @emilio's take on this issue :) |
This conversation has stalled, so let’s bring it back to life. Summary up until now is that Personally I would like to not use This for two reasons:
|
The reason I don't like
|
Maybe that’s OK? I don’t think we could ever make an auto work for cross-document (but of course would like to be proven wrong … discussion for later)
This gives me another idea: if it’s a function then it can optionally take an argument … which could totally be an attribute name – i.e. when using |
That ship has sailed: https://webkit.org/blog/16301/webkit-features-in-safari-18-2/#:~:text=WebKit%20for%20Safari%2018.2%20adds%20support%20for%20view%2Dtransition%2Dname%3A%20auto |
That's awful. @astearns does the CSS working group support that kind of behaviour? |
@fantasai can you comment on |
When I was working more closely on this feature, I put a lot of care into making sure folks across the group were happy with the design and spec of this feature, same with other features like |
I appreciate all of the discussion about Agenda+ to add |
I believe what happened is that there was agreement on adding it as re-iterated in the OP above, it was added to the spec, the WebKit team promptly implemented it in good faith as published in the spec and tested in WPT, and the objection subsequently raised here was too late to make any changes to the release.
Not an objection, but, what is the use case for |
Fallback value for [data-view-transition-name] {
view-transition-name: attr(data-view-transition-name type(<custom-ident>), match-element);
} |
In #8320, we resolved on using
view-transition-name: auto
as a way to generate names, using the element's id if exists.In the resolution, we said that we'll have another value for generating the name without falling back to ID, and perhaps yet another one for generating it only from ID.
Proposing:
view-transition-name: self
as the keyword for generating the name ignoring ID. Other proposals that were raised werefrom-element
andelement-uuid()
.attr(<ident> id)
.The text was updated successfully, but these errors were encountered: