Re: [csswg-drafts] [css-animations-2] Scoping keyframe names between UA and developer styles. (#7560)

The CSS Working Group just discussed `Scoping keyframe names in UA stylesheet`, and agreed to the following:

* `RESOLVED: Name UA-defined @keyframes rules with a -ua- prefix (and presumably use this pattern elsewhere as needed)`
* `RESOLVED: The -ua- names *are* usable in author/user stylesheets.`

<details><summary>The full IRC log of that discussion</summary>
&lt;TabAtkins> Topic: Scoping keyframe names in UA stylesheet<br>
&lt;TabAtkins> github: https://github.com/w3c/csswg-drafts/issues/7560<br>
&lt;TabAtkins> khush: Came up in impl for Shared Element Transitions, where the browser is making keyframes and using in the UA stylesheet<br>
&lt;TabAtkins> khush: Per spec right now, those @keyframes names can collide with author keyframes<br>
&lt;TabAtkins> khush: Issue has two proposals<br>
&lt;TabAtkins> khush: First is implicitly carrying source information around, so a UA 'animation-name' rule will look in the UA sheet first for keyframes<br>
&lt;TabAtkins> khush: Main issue with this is there's a bunch of script APIs which provide the keyframe name, and it becomes difficult for authors to tell which @keyframes is being referred to<br>
&lt;TabAtkins> khush: Alternate is making a syntax for keyframes names that can only be used in the UA stylesheet<br>
&lt;TabAtkins> khush: Tab's suggestion was `@keyframes ua(foo) {...}`<br>
&lt;flackr> q+<br>
&lt;TabAtkins> khush: Could be implicit or explicit, but would be `animation-name: ua(foo)`<br>
&lt;emilio> q+<br>
&lt;TabAtkins> khush: Also an issue if author stylesheets are allowed to explicitly use the value. Prefer not, it gives us more flexibility to change.<br>
&lt;TabAtkins> khush: I suggest we take TAb's suggestion of a ua() function<br>
&lt;Rossen_> q?<br>
&lt;Rossen_> ack fantasai<br>
&lt;fantasai> ua(name-of-animation)<br>
&lt;fantasai> -name-of-animation<br>
&lt;fantasai> -ua-name-of-animation<br>
&lt;TabAtkins> fantasai: Tab has several proposals. One is a function, another is a single-dash prefix, which isn't generally used, or specifically a `-ua-` prefix.<br>
&lt;TabAtkins> fantasai: Just wanted to point out several options.<br>
&lt;fantasai> s/options/options in the issue/<br>
&lt;TabAtkins> khush: I think single-dash can be used in an author stylesheet, so there's some compat risk.<br>
&lt;TabAtkins> flackr: The author stylesheets might refer to these for SET, right?<br>
&lt;fantasai> SET=Shared Element Transitions<br>
&lt;TabAtkins> flackr: My issue with scoping to the stylesheet (not allowing usage in author stylesheets) is authors might want to specify overrides for the proeprties that still use SET animation names<br>
&lt;Rossen_> ack flackr<br>
&lt;TabAtkins> khush: This can be done without overriding animation-name, by setting the longhang properties specifically.<br>
&lt;TabAtkins> khush: Just not a fan of allowing using it in a different context from where it's intended<br>
&lt;TabAtkins> flackr: That does prevent author from using the shorthand, tho<br>
&lt;TabAtkins> khush: yeah<br>
&lt;TabAtkins> flackr: So I have a slight preference for just using a naming convention, not putting a usage restriction<br>
&lt;Rossen_> ack emilio<br>
&lt;TabAtkins> emilio: I don't know if SET - it seems we want to expose the animatino to authors in some way<br>
&lt;TabAtkins> emilio: We have other at-rules in the UA sheet that we don't expose tho, like a @font-face<br>
&lt;TabAtkins> emilio: We just don't expose that in scripting APIs<br>
&lt;TabAtkins> emilio: Is that an option?<br>
&lt;TabAtkins> emilio: Otherwise I tend to lean to just using a naming convention.<br>
&lt;Rossen_> q?<br>
&lt;TabAtkins> emilio: There are use-cases for overriding animation names in user stylesheets, for example<br>
&lt;fantasai> TabAtkins: When you don't expose the name in scripting APIs, the name is still exposed in properties?<br>
&lt;fantasai> TabAtkins: If the author defines something of the same name, it would take precedence, right?<br>
&lt;fantasai> emilio: We chose -moz- prefixed things, since supposed to be internal implementation detail<br>
&lt;fantasai> emilio: naming convention, especially if we use -ua-, would allow user to override internal if they wanted<br>
&lt;fantasai> emilio: so that's what I meant, there may be a use case for users to adjust animations<br>
&lt;TabAtkins> fantasai: I think a naming convention is nice. Can decide if we want it to expose to the author or not for tweaking, but it allows that possibility. Seems usable/used in other places where we've run into similar problems.<br>
&lt;TabAtkins> khush: So is there a preference for one of the naming conventions?<br>
&lt;TabAtkins> fantasai: If it's author-exposed, I think -ua-foo is clear and fits into the syntaxes we might use it pretty easily.<br>
&lt;fantasai> s/easily/easily anywhere we need such a thing/<br>
&lt;TabAtkins> emilio: Agreed. No new syntax and it's reusable for other features.<br>
&lt;bradk> +1 for -ua- for reasons already mentioned<br>
&lt;TabAtkins> Rossen_: So sounds like a -ua- prefix is getting the most likes<br>
&lt;TabAtkins> Rossen_: Can we resolve?<br>
&lt;TabAtkins> khush: So consensus on -ua- prefix for UA-defined keyframes rules.<br>
&lt;TabAtkins> khush: And a second question about whether this can be used in author stylesheets or not, I'm not clear if there's objections on that yet.<br>
&lt;TabAtkins> Rossen_: So let's take those separately.<br>
&lt;TabAtkins> Rossen_: First, the prefix naming. Any objections to -ua- prefix?<br>
&lt;TabAtkins> RESOLVED: Name UA-defined @keyframes rules with a -ua- prefix (and presumably use this pattern elsewhere as needed)<br>
&lt;TabAtkins> Rossen_: Second, expose them to be usable in author stylesheets?<br>
&lt;TabAtkins> No opinion here<br>
&lt;TabAtkins> RESOLVED: The -ua- names *are* usable in author/user stylesheets.<br>
&lt;bradk> Hopefully auto prefixers will not start adding-ua- to everything.<br>
</details>


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


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

Received on Wednesday, 31 August 2022 16:29:02 UTC