Open noamr opened 2 weeks ago
Copying over my comment from 8320 for visibility:
One thing I don’t like about
from-element
is that it reads like “read the id from the element” which authors will interpret as “read the id attribute from the element”. Ideally the value makes it clear that it’s an internalid
, unrelated to theid
attribute.I think
element-uuid
as suggested in the OP comes closest to this.
Copying over my comment from 8320 for visibility:
One thing I don’t like about
from-element
is that it reads like “read the id from the element” which authors will interpret as “read the id attribute from the element”. Ideally the value makes it clear that it’s an internalid
, unrelated to theid
attribute. I thinkelement-uuid
as suggested in the OP comes closest to this.
Any thoughts on self
?
Not a big fan of it, but also not against it.
I recently read up on first-valid()
– which I didn’t know existed up until then.
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?
auto
= auto generate a name (element identity).attr(id "<ident>")
= use id attributefirst-non-empty(attr(id "<ident>"), auto)
= try getting id attribute first. if there is none, fall back to auto
behavior.That would prevent a lot of confusion on the author side, as auto
here now means “auto-generate a v-t-name”.
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. first-non-empty(attr(id "<ident>"), attr(data-name "<ident>"), auto)
first-non-empty(attr(id "<ident>"), auto)
= try getting id attribute first. if there is none, fall back toauto
behavior.That would prevent a lot of confusion on the author side, as
auto
here now means “auto-generate a v-t-name”.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.
first-non-empty(attr(id "<ident>"), attr(data-name "<ident>"), auto)
To me this feels too verbose for a feature that's supposed to be a DX convenience... I think once attr
is there we wouldn't need this. Though `first-non-empty might still be a valuable proposal regardless of auto view-transition-names.
I think the direction the auto
resolution went with is is to have some keywords that have reasonable defaults and to leave attr
etc. for the general-purpose more complex cases.
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)
.