Re: [csswg-drafts] [css-shared-element-transitions-1] Pseudo-element selectors for shared element transitions (#7743)

The CSS Working Group just discussed `Pseudo-element Selectors for shared element transitions`.

<details><summary>The full IRC log of that discussion</summary>
&lt;fantasai> Subtopic: Pseudo-element Selectors for shared element transitions<br>
&lt;fantasai> github: https://github.com/w3c/csswg-drafts/issues/7743<br>
&lt;fantasai> JakeA: what you see here is the default cross-fade<br>
&lt;fantasai> ... DOM change underneath is just one change<br>
&lt;fantasai> ... illusion of both bits of content on the screen at the same time is done through this pseudo-element<br>
&lt;fantasai> ... tree<br>
&lt;fantasai> ... These represent the two visual states<br>
&lt;fantasai> ... there's a wrapper around them, which applies isolation<br>
&lt;fantasai> ... and container there is what changes size and position<br>
&lt;fantasai> ... (not seen for root, but for sub-elements will see it)<br>
&lt;fantasai> JakeA: Developers can use these pseudo-elements to customize their stuff<br>
&lt;fantasai> ... e.g. change from cross-fade to sliding images from left to right<br>
&lt;fantasai> ... also have this page-transition-tag property<br>
&lt;fantasai> s/... also/JakeA: also<br>
&lt;fantasai> ... allows to capture page in separate parts, animate separately<br>
&lt;fantasai> ... so page slides and heading text cross-fades<br>
&lt;fantasai> JakeA: This creates a bigger pseudo-tree<br>
&lt;fantasai> ... each piece gets its own ::page-transition-container<br>
&lt;fantasai> ... and underneath it a wrapper around the two incoming/outgoing images<br>
&lt;fantasai> JakeA: Although it's a pseudo-tree, currently attached to root element<br>
&lt;fantasai> ... feels like cheating, because it doesn't really represent the structure of the pseudo-tree<br>
&lt;fantasai> ... but alternative would be [writes out a chain of pseudo-elements]<br>
&lt;fantasai> ... It's uncomfortable even with shortened names<br>
&lt;fantasai> JakeA: Tab came up with idea of using a pseudo-descendant combinator<br>
&lt;fantasai> JakeA: one question to group is, would it be appropriate to do something with function-liek syntax can be used on each piece of it<br>
&lt;fantasai> ... html :>> outgoing-image(header-text)<br>
&lt;fantasai> JakeA: I like this because it makes use of nesting<br>
&lt;fantasai> ... makes syntax simpler and nicer<br>
&lt;fantasai> JakeA: one alternative suggested to structure is what if we used shadow DOM instead<br>
&lt;fantasai> ... here we've got a shadow-root<br>
&lt;fantasai> ... and it's got basically same structure, using parts attribute for access into the tree<br>
&lt;fantasai> emilio: Bigger pro is, you avoid all this nested pseudo-elements for a particular feature<br>
&lt;fantasai> ... also a lot of new features are using shadow parts<br>
&lt;fantasai> ... I don't think of a use case that, well, shadow DOM is already restricted on root eleent<br>
&lt;fantasai> ... so can use it for UA features<br>
&lt;fantasai> ... if you replae with script the HTML element with something else, some of it wouldn't work<br>
&lt;fantasai> ... but all in all, it seems a bit better to re-use what the platform already has<br>
&lt;fantasai> ... I don't think there's anything that you can't do with pseudo-elements that you can't do with parts<br>
&lt;fantasai> JakeA: syntax of using parts, haven't seen for shipped feature yet<br>
&lt;fantasai> ... but we're happy with it?<br>
&lt;fantasai> emilio: THat's where all the new OpenUI stuff is going<br>
&lt;fantasai> ... I think it's reasonable<br>
&lt;fantasai> ... I'd rather do that than having 4 nested pseudo-elements<br>
&lt;fantasai> JakeA: I'd seen that in their proposal, unsure about feelings in this group<br>
&lt;fantasai> emilio: Tab designed parts so that authors and UA could have common mechanism to expose this kind of thing<br>
&lt;heycam> q+<br>
&lt;fantasai> TabAtkins: wasn't designed with intent of UA using it, but it was left open as a possibility<br>
&lt;khush> q+<br>
&lt;chrishtr> q+<br>
&lt;fantasai> JakeA: One of the things missing right now is ability drive animations with JS<br>
&lt;fantasai> ... or call things like getBoundingClientRect() on these things<br>
&lt;fantasai> ... and so our plan was, there was a stub bit of spec in the CSS Pseudo-element Spec to say maybe we'll expose these to JS at some point<br>
&lt;fantasai> ... but if we had a shadow root, we could just give devs access to the elements<br>
&lt;fantasai> ... and not do all that<br>
&lt;fantasai> emilio: That seems a bit trickier, in the sense that some of these elements, if I understand correctly, need some magic attached to them<br>
&lt;fantasai> ... rendering a texture that [missed]<br>
&lt;fantasai> ... not supposed to be moved around<br>
&lt;fantasai> ... so seems a bit tricky, fact that you can shuffle them around etc.<br>
&lt;heycam> s/[missed]/the compositor has taken a snapshot of/<br>
&lt;fantasai> JakeA: definitely don't want devs to take the elements out of the shadow root and have them continue to work<br>
&lt;fantasai> ... but can explain that if extracted the element, no longer...<br>
&lt;fantasai> emilio: nice thing about shadow parts, is also used elsewhere<br>
&lt;emilio> q+<br>
&lt;Rossen_> ack heycam<br>
&lt;fantasai> heycam: One thought about shadow root, gievn HTML element can't have one currently<br>
&lt;fantasai> ... could mechanism be that some new element is created which has this shadow tree structure, and placed in top layer<br>
&lt;fantasai> ... not attached to the root element<br>
&lt;fantasai> ... don't know where it would live in the document<br>
&lt;fantasai> JakeA: I floated a similar idea earlier<br>
&lt;fantasai> ... but your idea is simpler<br>
&lt;Rossen_> ack khush<br>
&lt;fantasai> khush: I had a thought, curious to get a bit more understanding about heycam was proposing<br>
&lt;fantasai> ... were you proposing a new tag that lives somewhere in the DOM that only exists to host a shadow root?<br>
&lt;fantasai> heycam: thinking that when the element transition is triggered, that would cause a new element to be inserted into the document<br>
&lt;fantasai> ... which has this structure behind it<br>
&lt;fantasai> ... its only purpose is to render the transition image, and it lives in the DOM<br>
&lt;fantasai> khush: idk what computations would run into... would be a shared-element-transition tag?<br>
&lt;fantasai> ... generally does UA create elements that have a temporary lifetime, and is node inserted by browser<br>
&lt;fantasai> ... was trying that we create pseudo-element, but ran into multiple issues because don't expect real DOM elements to have pseudo-elements as their ancestors<br>
&lt;fantasai> heycam: it just feels like it's not really part of the root HTML element either<br>
&lt;fantasai> JakeA: it's a "topper layer"<br>
&lt;fantasai> khush: One reason it has lin kto document is so that it has a way to do style resolution and layout<br>
&lt;fantasai> ... it needs a document to be associated with<br>
&lt;miriam> q+<br>
&lt;fantasai> ... otherwise it's using output of actual document to generate content<br>
&lt;fantasai> khush: Wanted to add, might be a weak arguemnt because need to be more clear<br>
&lt;fantasai> ... but one use case is multiple independent transitions on the page<br>
&lt;fantasai> ... currently it's global, works for the whole document, captures the entire page<br>
&lt;fantasai> ... but some cases where a developer can have 2 widgets on their page<br>
&lt;fantasai> ... 2 different DOM subtrees, would be nice to transitions on those subtrees independently<br>
&lt;fantasai> ... if shadow tree, can scope to each subtree<br>
&lt;fantasai> ... attach to root of that subtree<br>
&lt;fantasai> ... so using shadow DOM on the root for this<br>
&lt;fantasai> ... would not be able to do that on subtrees<br>
&lt;Rossen_> ack chrishtr<br>
&lt;fantasai> ... because only HTML can have this work<br>
&lt;fantasai> s/HTML/HTML element/<br>
&lt;fantasai> ... but using pseudo-elements, can expand in that direction<br>
&lt;fantasai> chrishtr: Question is what can authors use to style these elements<br>
&lt;fantasai> ... one is using pseudo-element syntax<br>
&lt;fantasai> ... or use shadow DOM syntax<br>
&lt;fantasai> ... not necessary to ???<br>
&lt;fantasai> chrishtr: so that's the choice: is there a pseudo-element or not, and if not it's implementation detail<br>
&lt;fantasai> ... maybe something exposed to devs in the future<br>
&lt;fantasai> ... need to think about what choice we make, how it impacts that<br>
&lt;fantasai> ... but it's really choice of syntax A or B<br>
&lt;fantasai> ... and 2 dimensions to weigh are, which has better ergonomics for devs<br>
&lt;fantasai> ... and which is easier to implement for implementers<br>
&lt;fantasai> emilio: My concern was not so much about difficult, but pseudo-elements, there are a lot of them<br>
&lt;fantasai> ... new names specific to this feature<br>
&lt;fantasai> ... to me feels we should avoid it<br>
&lt;fantasai> chrishtr: by analogy, components in OpenUI have a parts syntax on them, but doesn't mean can access the elements. Closed shadow DOM<br>
&lt;fantasai> ... web-components-like syntax<br>
&lt;heycam> q+<br>
&lt;fantasai> ... afaict, some devs are used to pseudo-elements<br>
&lt;fantasai> ... find the one they need and put it in their stylesheet<br>
&lt;fantasai> ... others that know about components might think ::parts one makes more sense<br>
&lt;fantasai> ... Further down can explain with conceptual shadow DOM<br>
&lt;fantasai> ... but to me it's really about that tradeoff<br>
&lt;fantasai> ... even if we expose shadow DOM<br>
&lt;JakeA> q+<br>
&lt;fantasai> ... there are UA features that are [missed]<br>
&lt;fantasai> ... I think you mentioned &lt;input> as an example<br>
&lt;Rossen_> ack emilio<br>
&lt;fantasai> emilio: To that regard, my point for using parts is<br>
&lt;fantasai> ... if you need to learn one of these things<br>
&lt;fantasai> ... shadow parts is something you'll learn once, and it'll be useful every time you use it<br>
&lt;fantasai> ... whether as an author or something else<br>
&lt;fantasai> chrishtr: The concept of parts yes, but still have to memorize the names of the parts<br>
&lt;fantasai> chrishtr: I personally don't have a strong opinion<br>
&lt;fantasai> ... I feel like the tradeoff should be more about which is easiest for developers<br>
&lt;fantasai> khush: Part which has not been clear to me, whether syntax implies shadow DOM or not<br>
&lt;fantasai> ... if we go with part syntax, is it still pseudo-elements?<br>
&lt;fantasai> ... wasn't clear if this syntax forces us to use a particular approach<br>
&lt;Rossen_> ack miriam<br>
&lt;fantasai> miriam: As an author, I've interacted with pseudo-elements more<br>
&lt;fantasai> ... but when I read the syntax here, the part syntax reads much simpler to me<br>
&lt;fantasai> ... it is a pseudo-element, and doesn't require special combinator syntax<br>
&lt;fantasai> ... looks cleaner to me, makes sense, I like it<br>
&lt;astearns> +1 to miriam<br>
&lt;TabAtkins> q+<br>
&lt;fantasai> ... I am also one of the ppl who will feel strongly about having multiple sub<br>
&lt;fantasai> ... don't want to take an approach that makes that impossible<br>
&lt;fantasai> s/sub/subtree<br>
&lt;emilio> q+<br>
&lt;fantasai> chrishtr: important your point that we don't need additoinal syntax for pseudo-element trees<br>
&lt;fantasai> JakeA: if we use the part syntax, you will not get nesting<br>
&lt;fantasai> miriam: will I need it?<br>
&lt;fantasai> fantasai: You had that proposal about nesting<br>
&lt;fantasai> JakeA: could maybe put more classes in the part<br>
&lt;fantasai> ... but you lose the strucutre this gets you<br>
&lt;Rossen_> ack heycam<br>
&lt;vmpstr> would the part syntax also prevent attaching this structure to an element that has a shadow dom (since part would select the shadow dom?)<br>
&lt;fantasai> heycam: proposal is for transitions in the document, but idea is to go later to entire document transitions?<br>
&lt;fantasai> JakeA: other way around, right now it's one transition that covers the whole document<br>
&lt;fantasai> ... but it's same document transition<br>
&lt;fantasai> ... but intention is to go to cross-document transitions in the near future<br>
&lt;fantasai> heycam: for cross-document, seems like the shadow DOM mechanism wouldn't be appropraite<br>
&lt;fantasai> ... because they would go away when you switch documents<br>
&lt;fantasai> ... so can't describe the state across the transition<br>
&lt;fantasai> JakeA: it would be the same tree that we would use with pseudo-elements<br>
&lt;fantasai> ... screenshots from previous page would be in the shadow DOM of the new document<br>
&lt;fantasai> chrishtr: would certainly require special code<br>
&lt;fantasai> JakeA: would only be same-origin, btw<br>
&lt;fantasai> heycam: all the pseudo-elements, need to live in both old and new document<br>
&lt;fantasai> JakeA: only new one<br>
&lt;fantasai> fremy: you take a photo of old document, and then swithc to new one<br>
&lt;fantasai> ... only one document active<br>
&lt;fantasai> heycam: so in old document, no pseudos get created<br>
&lt;fantasai> fremy: right<br>
&lt;fantasai> chrishtr: but during animation, new document is inert<br>
&lt;Rossen_> ack JakeA<br>
&lt;fantasai> JakeA: One thing I'm worried about is, we want devs to have references to things they can call getBoundingClientREct, to control inline styles<br>
&lt;fantasai> ... to increase the proposal for a reference to a pseudo-element and put these on them<br>
&lt;fantasai> ... add .animate, .style<br>
&lt;fantasai> ... I'm slightly worried we get trouble if using parts, because getting pseudo-eelemnt reference for something that is an element<br>
&lt;fantasai> heycam: animations?<br>
&lt;fantasai> JakeA: .style.whatever<br>
&lt;fantasai> ... if we create pseudo-element object, will it make sense if the underlying thing is an actual element?<br>
&lt;fantasai> heycam: internally, this kind of thing will be ....<br>
&lt;fantasai> ... more a matter of making sure API exposes the right things<br>
&lt;Rossen_> ack TabAtkins<br>
&lt;fantasai> TabAtkins: A little bit ago, Miriam said she preferred look of the parts API, more simple naming<br>
&lt;fantasai> ... I'll note that if that's what we care about, we can do that with pseudo-elements, too<br>
&lt;fantasai> ... if that's a significant plus, we can make the tarnsition API work like that with pseudo-element sor with parts<br>
&lt;fantasai> ... we don't ahve to bring one or the other based on that specific issue<br>
&lt;fantasai> JakeA: current API in canary is simlilar, everything hangs off root eleent<br>
&lt;fantasai> ... change something like this to ::part() with same text inside<br>
&lt;fantasai> ... here we've put page-transition to separate from other features<br>
&lt;fantasai> ... would need to do same with aprt syntax<br>
&lt;fantasai> ... to crate a namespace for our feature<br>
&lt;fantasai> s/crate/create/<br>
&lt;TabAtkins> ahhhh<br>
&lt;fantasai> emilio: regarding .style etc.<br>
&lt;Rossen_> ack emilio<br>
&lt;fantasai> ... right now I don't think we expose either parts or pseudo-elements as things you can change style of<br>
&lt;fantasai> ... but if we did, I thin you'd get more chances for that with parts than pseudo-elements<br>
&lt;fantasai> ... because pseudos don't have attributes<br>
&lt;fantasai> ... not all speudos can have attributes<br>
&lt;heycam> fantasai: trying to think through how much of this is feeling awkward because it's really long, or how much because of the structure of it<br>
&lt;heycam> ... if there's way to use pseudo element syntax that's more compact, maybe then it would feel more comfortable<br>
&lt;emilio> q+<br>
&lt;fantasai> fantasai: also wrt khush's point about subtrees, I think leaving that possibility open is important<br>
&lt;heycam> khush: I think the conclusion I'm hearing is to go with part for now, which leaves it open for each engine to decide, whether it's backed with pseudos or shadow DOM, and when we hit implementation, we decide at that point<br>
&lt;vmpstr> q+<br>
&lt;fantasai> JakeA: I tihnk we need to write up both proposals possible<br>
&lt;emeyer> A question: Will it be possible for cross-document transitions to also animate shared elements?  (Similar to Magic Move in Keynote, where an element can scale and move and change opacity as part of the slide transition.)  If not, should we design syntax such that it could be possible in the future?<br>
&lt;fantasai> ... used shorter syntax for parts examples, but in reality would need to be longer<br>
&lt;fantasai> emeyer, yes<br>
&lt;Rossen_> ack emilio<br>
&lt;fantasai> emeyer: I think maybe ??? is a non-issue with parts<br>
&lt;fantasai> s/emeyer/emilio/<br>
&lt;fantasai> ... because doesn't interact with rest of page<br>
&lt;fantasai> emilio: if we go with parts, most realistic way to implement is using shadow DOM<br>
&lt;Rossen_> ack vmpstr<br>
&lt;fantasai> vmpstr: if we go with the part syntax, wouldn't that still run into issue of backed by pseudo-element but scoped to an element that has a shadow DOM attached by developer<br>
&lt;emilio> s/???/animations in ua sheets<br>
&lt;fantasai> ... wouldn't part syntax then be ambiguous?<br>
&lt;fantasai> JakeA: are you talking about a scoped transition?<br>
&lt;fantasai> vmpstr: yes<br>
&lt;fantasai> JakeA: yeah that's a big issue<br>
&lt;emilio> q+<br>
&lt;fantasai> vmpstr: unclear whether to look in shadow DOM or pseudo-tree<br>
&lt;fantasai> emilio: it's true<br>
&lt;Rossen_> ack emilio<br>
&lt;fantasai> ... but to be honest, this scoped transition thing raises more questions than answers<br>
&lt;fantasai> ... be good to have a concrete proposal of how that would look like<br>
&lt;fantasai> ... before deciding to use or not use one approach<br>
&lt;fantasai> ... at the point where root of transition can mutate<br>
&lt;fantasai> ... right now proposla is only for docuemnt transition. You know document is not going away<br>
&lt;fantasai> ... various things not changing<br>
&lt;fantasai> ... if you scope the transition to the element, need to define what happens when authors hide or move the element<br>
&lt;fantasai> ... or whatnot<br>
&lt;fantasai> ... raises a lot more complications than I'm comfortable with<br>
&lt;fantasai> Rossen_: I want to see if we can close the discussion<br>
&lt;fantasai> Rossen_: quite a bit of feedback here, what should we do next?<br>
&lt;fantasai> JakeA: I think our action items are to draw up pros and cons of each approach, and maybe also mid-approach where implemented with shadow DOM but use pseudo-elements to access it<br>
&lt;fantasai> ... and sketch out scoped transitoins to figure out how it works<br>
&lt;fantasai> TabAtkins: coming up with half-reasonable short names with each would also be helpful<br>
&lt;fantasai> ACTION: JakeA and khush to draw up pros and cons for shadow DOM vs pseudo-elements vs mixed approaches<br>
&lt;astearns> so I am dreading s/transition-container/trainer/<br>
&lt;fantasai> ACTION: JakeA and khush to sketch out scoped transitions to see how they work<br>
&lt;fantasai> ACTIOn: JakeA and khush to find shorter names for things<br>
</details>


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


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

Received on Friday, 16 September 2022 00:47:40 UTC